# file log4j.appender.file=org.apache.log4j.RollingFileAppender log4j.appender.file.maxFileSize=2MB log4j.appender.file.maxBackupIndex=50 log4j.appender.file.File=./log/log.log log4j.appender.file.threshold=debug log4j.appender.file.layout=org.apache.log4j.PatternLayout log4j.appender.file.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %l - %m%n # stdout 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{yyyy-MM-dd HH:mm:ss} %-5p [%t] %l - %m%n # html log4j.appender.html=org.apache.log4j.FileAppender log4j.appender.html.File=./log/log.html log4j.appender.html.MaxBackupIndex=3 log4j.appender.html.layout=org.apache.log4j.HTMLLayout log4j.appender.html.layout.Title=HTML Layout Example log4j.appender.html.layout.LocationInfo=true # rootLogger log4j.rootLogger=info, stdout, file # log level log4j.logger.net.phoenix.learn.log4jsample=debug
log4j.properties配置可参考该博文http://blog.csdn.net/edward0830ly/article/details/8250412
- 将tomcat-juli.jar放置在tomcat/bin目录中,替换原来的。
- 将tomcat-juli-adapters.jar、log4j-1.2.17.jar、log4j.properties放置在tomcat/lib目录下。
- 删除tomcat/conf目录下的logging.properties文件。