Log4j案例

以前从来没有认真的研究过Log4j的具体配置,由于项目需要,今天大概的看了下,有些细节如下:

log4j.rootLogger=INFO,CONSOLE,ROLLING_FILE
log4j.logger.info.agent=INFO
log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack=ERROR
###################
# Console Appender
###################
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
#May use higher logging level in Production Env to avoid redundant msg.
log4j.appender.CONSOLE.Threshold=INFO
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=/u301095080/u3011%p [%t] %d{ISO8601} %c{1}.%M@%L - %m%n
#log4j.appender.CONSOLE.layout.ConversionPattern=[start]%d{DATE}[DATE]%n%p[PRIORITY]%n%x[NDC]%n%t[THREAD] n%c[CATEGORY]%n%m[MESSAGE]%n%n


########################
# Date File
########################
log4j.appender.ROLLING_FILE=org.apache.log4j.DailyRollingFileAppender
log4j.appender.ROLLING_FILE.Threshold=INFO
log4j.appender.ROLLING_FILE.DatePattern='.'yyyy-MM-dd
log4j.appender.ROLLING_FILE.File=/logs/ZHCallCenter.log
log4j.appender.ROLLING_FILE.Append=true
log4j.appender.ROLLING_FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.ROLLING_FILE.layout.ConversionPattern=/u301095080/u3011%p [%t] %d{ISO8601} %c{1}.%M@%L - %m%n

你可能感兴趣的:(Log4j案例)