tomcat下catalina.out日志文件分割
tomcat默认使用java.util.logging记录日志,默认只记录tomcat的日志,不记录应用的日志。tomcat支持采用log4j进行日志记录,配置方法如下:
1.更新最新的tomcat_juli.jar包到./bin/目录下;
2.拷贝log4j.jar,lo4j.properties到./lib目录下;
3.删除./conf/logging.properties
4.重启
log4j配置样本
- log4j.rootLogger=INFO,CATALINA
- log4j.logger.com.danga.MemCached.MemCachedClient=WARN,CATALINA
- #log4j.appender.CONSOLE = org.apache.log4j.ConsoleAppender
- #log4j.appender.CONSOLE.layout = org.apache.log4j.PatternLayout
- #log4j.appender.CONSOLE.encoding = UTF-8
- #log4j.appender.CONSOLE.layout.conversionPattern =[%p-%d{yyyy/MM/dd/HH\:mm\:ss}]%c{1}.(%L) - %m%n
- # Define CATALINA appenders
- log4j.appender.CATALINA = org.apache.log4j.DailyRollingFileAppender
- log4j.appender.CATALINA.file = ${catalina.base}/logs/catalina.out
- log4j.appender.CATALINA.DatePattern ='.'yyyy-MM-dd
- log4j.appender.CATALINA.layout = org.apache.log4j.PatternLayout
- log4j.appender.CATALINA.layout.conversionPattern = [%p-%d{yyyy/MM/dd/HH\:mm\:ss}]%c{1}.(%L) - %m%n
- log4j.appender.CATALINA.append = true
lo4j自动在午夜切割catalina.out成catalina.out.2011-03-07
相关推荐
chw0 2020-11-04
大唐帝国前营 2020-08-18
sdaq 2020-07-26
MrLiar 2020-07-07
sdaq 2020-06-16
CXC0 2020-06-14
丨Fanny丨Cri 2020-06-13
CXC0 2020-06-08
dongxurr 2020-06-07
sdaq 2020-06-06
MrLiar 2020-06-04
丨Fanny丨Cri 2020-06-03
MrLiar 2020-05-25
丨Fanny丨Cri 2020-05-17
MrLiar 2020-05-14
MrLiar 2020-05-12
sdaq 2020-05-11