#local log4j.rootCategory=ERROR, stdout,report-error #online #log4j.rootCategory=ERROR,report-error #Console log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d [%t] %p [%c] - <%m>%n log4j.logger.org.apache.ibatis=DEBUG log4j.logger.java.sql=DEBUG #wx-report log4j.logger.com.jn.iexcel=DEBUG,report log4j.appender.report=org.apache.log4j.DailyRollingFileAppender log4j.appender.report.encoding=UTF-8 log4j.appender.report.File=/data/logs/wx-report/bi-report.log log4j.appender.report.layout=org.apache.log4j.PatternLayout log4j.appender.report.layout.ConversionPattern =%d [%t] %-5p [%c] - %m%n Threshold=DEBUG log4j.logger.report-error=error log4j.appender.report-error=org.apache.log4j.DailyRollingFileAppender log4j.appender.report-error.encoding=UTF-8 log4j.appender.report-error.File=/data/logs/wx-report-error/bi-report-error.log log4j.appender.report-error.Append = true log4j.appender.report-error.Threshold = ERROR log4j.appender.report-error.layout=org.apache.log4j.PatternLayout log4j.appender.report-error.layout.ConversionPattern =%d [%t] %-5p [%c] - %m%n
其餘參數:java
%m 輸出代碼中指定的消息
%p 輸出優先級,即DEBUG,INFO,WARN,ERROR,FATAL
%r 輸出自應用啓動到輸出該log信息耗費的毫秒數
%c 輸出所屬的類目,一般就是所在類的全名
%t 輸出產生該日誌事件的線程名
%n 輸出一個回車換行符,Windows平臺爲「rn」,Unix平臺爲「n」
%d 輸出日誌時間點的日期或時間,默認格式爲ISO8601,也能夠在其後指定格式,好比:%d{yyyy MMM dd HH:mm:ss,SSS},輸出相似:2002年10月18日 :10:28,921
%l 輸出日誌事件的發生位置,包括類目名、發生的線程,以及在代碼中的行數。sql
%x Used to output the NDC (nested diagnostic context) associated with the thread that generated the logging eventapache
%X Used to output the MDC (mapped diagnostic context) associated with the thread that generated the logging event for specified key app
#locallog4j.rootCategory=ERROR, stdout,report-error#online #log4j.rootCategory=ERROR,report-error
#Consolelog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d [%t] %p [%c] - <%m>%n
log4j.logger.org.apache.ibatis=DEBUGlog4j.logger.java.sql=DEBUG
#wx-reportlog4j.logger.com.jn.iexcel=DEBUG,reportlog4j.appender.report=org.apache.log4j.DailyRollingFileAppenderlog4j.appender.report.encoding=UTF-8log4j.appender.report.File=/data/logs/wx-report/bi-report.loglog4j.appender.report.layout=org.apache.log4j.PatternLayoutlog4j.appender.report.layout.ConversionPattern =%d [%t] %-5p [%c] - %m%nThreshold=DEBUG
log4j.logger.report-error=error log4j.appender.report-error=org.apache.log4j.DailyRollingFileAppenderlog4j.appender.report-error.encoding=UTF-8log4j.appender.report-error.File=/data/logs/wx-report-error/bi-report-error.loglog4j.appender.report-error.Append = truelog4j.appender.report-error.Threshold = ERRORlog4j.appender.report-error.layout=org.apache.log4j.PatternLayoutlog4j.appender.report-error.layout.ConversionPattern =%d [%t] %-5p [%c] - %m%nspa