log4j日志文件配置

### set log levels ###
### debug (打印代码中logger.debug(xx)的信息)> info(打印代码中logger.info(xx)的信息)
log4j.rootLogger = info , C , D , E

### console ###
log4j.appender.C = org.apache.log4j.ConsoleAppender
log4j.appender.C.Target = System.out
log4j.appender.C.layout = org.apache.log4j.PatternLayout
log4j.appender.C.layout.ConversionPattern = [xmut-lgrg][%p] [%-d{yyyy-MM-dd HH:mm:ss}] %C.%M(%L) | %m%n

### log file ###
log4j.appender.D = org.apache.log4j.DailyRollingFileAppender
log4j.appender.D.File =logs/xmut-lgrg.log(保存到logs下的文件夹)
log4j.appender.D.Append = true
log4j.appender.D.Threshold = INFO(info级别)
log4j.appender.D.layout = org.apache.log4j.PatternLayout
log4j.appender.D.layout.ConversionPattern = [xmut-lgrg][%p] [%-d{yyyy-MM-dd HH:mm:ss}] %C.%M(%L) | %m%n

### exception ###
log4j.appender.E = org.apache.log4j.DailyRollingFileAppender
log4j.appender.E.File = ../logs/xmut-lgrg_error.log
log4j.appender.E.Append = true
log4j.appender.E.Threshold = ERROR
log4j.appender.E.layout = org.apache.log4j.PatternLayout
log4j.appender.E.layout.ConversionPattern = [xmut-lgrg][%p] [%-d{yyyy-MM-dd HH:mm:ss}] %C.%M(%L) | %m%n

  

posted @ 2017-11-29 21:19  林加欣  阅读(253)  评论(0编辑  收藏  举报