Tomcat 5.5 日志文件配置方法
在使用Tomcat 开发项目时,需要打印出更多的信息时,需要配置Tomcat 日志文件。配置方法如下:
一、首先需要准备的文件:
1.log4j.jar , 下载地址 :http://www.apache.org/dist/logging/log4j/1.2.15/apache-log4j-1.2.15.zip
2.Tomcat 5.5所需的 commons-logging.jar,下载地址:http://www.apache.org/dist/commons/logging/binaries/commons-logging-1.1.zip
3.log4j配置文件:
log4j.properties
配置内容为:log4j.rootLogger=ERROR,R log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout log4j.appender.CONSOLE.layout.ConversionPattern=[%p]%t-%c-%m%n log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=${catalina.home}/logs/tomcat.log log4j.appender.R.MaxFileSize=10MB log4j.appender.R.MaxBackupIndex=10 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=[%p]%t-%c-%m%n log4j.logger.org.apache.catalina=INFO,R,CONSOLE
4.将log4j.properties放在 classess 目录下。重新运行Tomcat。
相关推荐
chw0 2020-11-04
sdaq 2020-07-26
MrLiar 2020-07-07
sdaq 2020-06-16
丨Fanny丨Cri 2020-06-13
CXC0 2020-06-08
MrLiar 2020-06-04
丨Fanny丨Cri 2020-06-03
丨Fanny丨Cri 2020-05-17
JavaWinner 2020-05-10
JavaWinner 2020-05-04
CXC0 2020-04-20
CXC0 2020-04-10
丨Fanny丨Cri 2020-02-18
MrLiar 2020-02-16
CXC0 2020-02-09