Description
To use the custom appenders, add this code in your init plugin for example: Choose among appenders (LoggerAppenderDailyFile, LoggerAppenderRollingFile, LoggerAppenderFile, LoggerAppenderMail, LoggerAppenderMailEvent), for each type you must
specify the relative parameters, how to official documentation of log4php.
-
For rolling file appenders:
‘1MB’, My_Logger::ROLLING_APPENDER => true, My_Logger::ROLLING_MAX_BACKUP_INDEX => 5 ); $mylogger = My_Logger::get_instance(“”, My_Logger::ROLLING, $parameters); $this->logger = $mylogger->getLogger(); //for debug you add: $this->logger->debug($parameters); $this->logger->debug(“test”); ?>
-
For mail appender: ”, My_Logger::MAIL_TO => ”, My_Logger::MAIL_SUBJECT => ”, My_Logger::THRESHOLD => My_Logger::LEVEL_DEBUG//6: Sets the root logger level to DEBUG. This means that logging requests with the level lower than DEBUG will not be logged by the root logger. );
$mylogger = My_Logger::get_instance(“”, My_Logger::MAIL, $parameters); ?>
** SET Logger threshold ** A level describes the severity of a logging message. There are six levels, show here in descending order of severity. You can set level of logger, add the parameter:
- FATAL Highest Very severe error events that will presumably lead the application to abort.
- ERROR … Error events that might still allow the application to continue running.
- WARN … Potentially harmful situations which still allow the application to continue running.
- INFO … Informational messages that highlight the progress of the application at coarse-grained level.
- DEBUG … Fine-grained informational events that are most useful to debug an application.
- TRACE Lowest Finest-grained informational events.
If do you want put a logger in frontend, add this code in template script: ‘1MB’, My_Logger::ROLLING_APPENDER => true, My_Logger::ROLLING_MAX_BACKUP_INDEX => 5, My_Logger::THRESHOLD => My_Logger::LEVEL_DEBUG );
$mylogger = new My_Logger(“”, My_Logger::ROLLING, $parameters);
$logger = $mylogger->getLogger(); $logger->debug(“test my logger”); ?>
For more info read the API documents of log4php:Apache Log4php Docs
** Configuration ** You can set configuration path file to export your logger, in the plugin’s settings.
Installation
- Upload
wp-mylogger.php
to the/wp-content/plugins/
directory - Activate the plugin through the ‘Plugins’ menu in WordPress
Reviews
There are no reviews for this plugin.
Contributors & Developers
“WP MyLogger” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “WP MyLogger” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0
- First version with integration a custom appender log4php.