# filelog4j.appender.file=org.apache.log4j.RollingFileAppenderlog4j.appender.file.maxFileSize=2MBlog4j.appender.file.maxBackupIndex=50log4j.appender.file.File=./log/log.loglog4j.appender.file.threshold=debuglog4j.appender.file.layout=org.apache.log4j.PatternLayoutlog4j.appender.file.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %l - %m%n# stdoutlog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.Target=System.outlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%-d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %l - %m%n# htmllog4j.appender.html=org.apache.log4j.FileAppenderlog4j.appender.html.File=./log/log.htmllog4j.appender.html.MaxBackupIndex=3 log4j.appender.html.layout=org.apache.log4j.HTMLLayoutlog4j.appender.html.layout.Title=HTML Layout Examplelog4j.appender.html.layout.LocationInfo=true# rootLoggerlog4j.rootLogger=info, stdout, file# log levellog4j.logger.net.phoenix.learn.log4jsample=debug
log4j.properties配置可参考该博文
- 将tomcat-juli.jar放置在tomcat/bin目录中,替换原来的。
- 将tomcat-juli-adapters.jar、log4j-1.2.17.jar、log4j.properties放置在tomcat/lib目录下。
- 删除tomcat/conf目录下的logging.properties文件。