首页 > 服务器 > Web服务器 > 正文

Linux tomcat下catalina.out日志文件分割

2024-09-01 13:50:40
字体:
来源:转载
供稿:网友

Linux 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

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表