log4j 每天生成文件(备忘)

简述:

log4j.properties每日生成日志文件


配置(运行在tomcat里):

log4j.properties

log4j.rootLogger=INFO,R,stdout,FILE  
  
log4j.appender.stdout=org.apache.log4j.ConsoleAppender  
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=Logger-->%5p{%F:%L}-%m%n 
  
log4j.appender.R=org.apache.log4j.DailyRollingFileAppender  
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=Logger-->%5p{%F:%L}-%m%n 

log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender  
log4j.appender.FILE.Append=true  
log4j.appender.FILE.File=../webapps/WebProj/logs/webproj.log
log4j.appender.FILE.Threshold=INFO
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout  
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd  HH:mm:ss} [%5p] - %c -%F(%L) -%m%n  
log4j.appender.FILE.MaxFileSize=10MB







你可能感兴趣的:(log4j 每天生成文件(备忘))