该插件尚未通过WordPress的最新3个主要版本进行测试。 当与较新版本的WordPress一起使用时,可能不再受到维护或支持,并且可能会存在兼容性问题。

WP MyLogger

描述

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.

安装

  1. Upload wp-mylogger.php to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress

评价

此插件暂无评价。

贡献者及开发者

“WP MyLogger” 是开源软件。 以下人员对此插件做出了贡献。

贡献者

将“WP MyLogger”翻译成您的语言。

对开发感兴趣吗?

您可以浏览代码,查看SVN仓库,或通过RSS订阅开发日志

更新日志

1.0

  • First version with integration a custom appender log4php.