标签:
我使用的tomcat版本: apache-tomcat-6.0.35
tomcat-6.0.35下载地址:https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.35/bin/
所需要jar包: tomcat-juli-adapters.jar log4j-1.2.15.jar tomcat-juli.jar
jar包下载地址: https://archive.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/extras/
需要log4j配置文件: log4j.properties
附log4j.properties配置文件
# This is the configuring for logging displayed in the Application Server # TRACE DEBUG INFO WARN ERROR # 默认日志级别,输出位置 log4j.rootCategory=DEBUG, logfile,stdout #stdout configure log4j.appender.stdout=org.apache.log4j.ConsoleAppender # 是否打印到控制台上 #log4j.appender.stdout.Target=System.err log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern= %d %p [%c] - <%m>%n #logfile configure log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
#${catalina.home}:tomcat的位置 log4j.appender.logfile.File=${catalina.home}/logs/tomcat.log log4j.appender.logfile.layout=org.apache.log4j.PatternLayout log4j.appender.logfile.layout.ConversionPattern= %d %p [%c] - <%m>%n
操作步骤:
1.将tomcat-juli-adapters.jar, log4j-1.2.15.jar, log4j.properties复制到tomcat/lib路径下.
2.将tomcat-juli.jar复制到tomcat/bin路径下.
3.启动tomcat验证tomcat/logs下是否有日志产生.
#日志级别不能太低,如果配置为debug的话,输出的日志信息太多,导致tomcat启动非常的慢.
参考: http://618119.com/archives/2007/12/04/37.html
标签:
原文地址:http://www.cnblogs.com/vaer/p/4320013.html