本配置可以完美的输出数据库操作等日志信息;
log4j.rootLogger=info,alllog4j.logger.org.springframework=info,spring,all,stdout
log4j.logger.org.apache=info,all
log4j.logger.com.ibatis=debug,all,stdout
log4j.logger.java.sql=debug,all,stdout
log4j.logger.com.digital.smartjsmgr=debug,all,stdout
log4j.logger.com.ibm=info,all,stdout
log4j.logger.com.mchange=info,all,stdout
#--------------- All Logger ------------------------------------------
log4j.appender.all =org.apache.log4j.RollingFileAppender
org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
log4j.appender.all.File =../logs/all.log
log4j.appender.all.BufferSize=100
log4j.appender.all.MaxFileSize =500KB
log4j.appender.all.MaxBackupIndex =5
log4j.appender.all.layout =org.apache.log4j.PatternLayout
log4j.appender.all.layout.ConversionPattern=%n+<%d{yyyy-MM-dd HH:mm:ss-S}><%l>%n+<%-5p>---<%t><%m>%n
#-------------- Spring Logger ----------------------------------------
log4j.appender.spring =org.apache.log4j.RollingFileAppender
log4j.appender.spring.File =../logs/spring.log
log4j.appender.spring.BufferSize=100
log4j.appender.spring.MaxFileSize =200KB
log4j.appender.spring.MaxBackupIndex =5
log4j.appender.spring.layout =org.apache.log4j.PatternLayout
log4j.appender.spring.layout.ConversionPattern=%n+<%d{yyyy-MM-dd HH:mm:ss-S}><%l>%n+<%-5p>---<%t><%m>%n
#-----------------stdout logger--------------------------------------
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %5p %C:%M:%L - %m%n
本文出自 “梦朝思夕” 博客,请务必保留此出处http://qiangmzsx.blog.51cto.com/2052549/1199693