(PECL mongo >=1.2.3)
Logging can be used to get detailed information about what the driver is doing. Logging is disabled by default, but this class allows you to activate specific levels of logging for various parts of the driver. Some examples:
<?php
// print every log message possible
MongoLog::setLevel(MongoLog::ALL); // all log levels
MongoLog::setModule(MongoLog::ALL); // all parts of the driver
// print significant events about replica set failover
MongoLog::setLevel(MongoLog::INFO);
MongoLog::setModule(MongoLog::RS);
// print info- and diagnostic-level events for replica sets and connections
MongoLog::setLevel(MongoLog::INFO|MongoLog::FINE);
MongoLog::setModule(MongoLog::RS|MongoLog::CON);
?>
Notă:
By default, MongoLog emits all log messages as PHP notices. Depending on the SAPI you use, messages may be sent to stderr (for CLI) or the web server's error log. If, after configuring MongoLog, log messages are not appearing as expected, ensure that the
E_NOTICE
bit is included in error_reporting and that display_errors is on.
These constants can be used by both MongoLog::setLevel() and MongoLog::setModule().
MongoLog::NONE
MongoLog::ALL
These constants can be used by MongoLog::setLevel().
MongoLog::WARNING
MongoLog::INFO
MongoLog::FINE
These constants can be used by MongoLog::setModule().
MongoLog::CON
MongoLog::IO
MongoLog::PARSE
MongoLog::POOL
MongoLog::RS
.
MongoLog::RS
MongoLog::SERVER
MongoLog::RS
.
Versiune | Descriere |
---|---|
1.3.0 |
Added MongoLog::CON and deprecated
MongoLog::POOL and
MongoLog::SERVER .
|