log4j 写多个日志文件,按照日期每天都记

 

小弟前些日子诊对Log4j做了个测试,主要实现以下功能,日志要分多个日志记录.而且要分每天都记一个日志文件..
详细的代码如下,提醒自己以后要经常看.
# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml! # For all other servers: Comment out the Log4J listener in web.xml to activate Log4J. log4j.rootLogger=INFO,stdout,syslog log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n log4j.appender.syslog=org.apache.log4j.RollingFileAppender log4j.appender.syslog.layout=org.apache.log4j.PatternLayout log4j.appender.syslog.layout.ConversionPattern=%d %p [%c] - %m%n log4j.appender.syslog.File=../logs/kaila/syslog.log log4j.appender.syslog.MaxFileSize=1024KB log4j.appender.syslog.MaxBackupIndex=10 log4j.logger.revice = info,revice log4j.appender.revice =org.apache.log4j.DailyRollingFileAppender log4j.appender.revice.layout=org.apache.log4j.PatternLayout log4j.appender.revice.layout.ConversionPattern=%d %p [%c] - %m%n log4j.appender.revice.File=../logs/kaila/revice.log log4j.appender.revice.DatePattern='.'yyyy-MM-dd'.log' log4j.logger.report = info,report log4j.appender.report =org.apache.log4j.DailyRollingFileAppender log4j.appender.report.layout=org.apache.log4j.PatternLayout log4j.appender.report.layout.ConversionPattern=%d %p [%c] - %m%n log4j.appender.report.File=../logs/kaila/report.log log4j.appender.report.DatePattern='.'yyyy-MM-dd'.log'
但是有一个小小的BUG,在记录分开日志的时候总是会在系统日志里面记录一份.还有记录的日志为
revice.log.2009-07-25.log  我想把中间的".log"给去掉,

你可能感兴趣的:(tomcat)