下载地址:
http://logging.apache.org/log4php/
log4php.properties的配置文件的设置
1、最好与index.php放到同一目录下
2、在index.php中包含logger文件
require_once('log4php/Logger.php');
3、配置appender
形式为log4php.appender.appenderName =
log4php.appender.appenderName.layout=
log4php.appender.appenderName.file =
配置日志名
log4php.rootLogger = DEBUG, appenderName
或者log4php.logger.logName = warn, appenderName
appender可以配置的值
Name | Destination |
---|---|
LoggerAppenderConsole | Console, directly to the stdout or stderr stream. |
LoggerAppenderEcho | Console, using the PHP echo command. |
LoggerAppenderFile | A file. |
LoggerAppenderDailyFile | A file (new file each day). |
LoggerAppenderRollingFile | A file (new file when a specified size has been reached). |
LoggerAppenderMail | Sends the log via email. The entire log is sent in one email. |
LoggerAppenderMailEvent | Sends the log via email. Each log entry is sent in individual emails. |
LoggerAppenderMongoDB | MongoDB. |
LoggerAppenderNull | Ignores all log events. |
LoggerAppenderPDO | Database. |
LoggerAppenderPhp | Creates a PHP user-level message using the PHP trigger_error() function. |
LoggerAppenderSocket | A network socket. |
LoggerAppenderSyslog | Syslog. |
Name | Description |
---|---|
LoggerLayoutHTML | Outputs events in a HTML table. |
LoggerLayoutPattern | A flexible layout configurable via a pattern string. |
LoggerLayoutSimple | A simple, non configurable layout. |
LoggerLayoutSerialized | Outputs serialized objects. |
LoggerLayoutTTCC | Consists of Time, Thread, Category and nested diagnostic Context. DEPRECATED |
LoggerLayoutXml | Outputs events as an XML document. |