Log4j 日志配置

自己用到的例子:
log4j.properties

#log4j.rootCategory=INFO,stdout, R , E
log4j.rootCategory=DEBUG,stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender  
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout  
log4j.appender.stdout.layout.ConversionPattern=%d-[HL] %p %t %c{3} - %m%n  
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File=/Users/mango/AppEmulator.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.DatePattern  ='.'yyyy-MM-dd
log4j.appender.R.layout.ConversionPattern=%d-[HL] %p %t %c{3} - %m%n

#error log
log4j.appender.E.Threshold = ERROR
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.File = /Users/mango/AppEmulatorError.log
log4j.appender.E.layout = org.apache.log4j.PatternLayout
log4j.appender.E.DatePattern='.'yyyy-MM-dd
log4j.appender.E.layout.ConversionPattern=%d-[HL] %p %t %c{3} - %m%n
log4j.logger.org.apache.mina=OFF

参考Log4j日志配置

你可能感兴趣的:(Log4j 日志配置)