Linux tomcat下catalina.out日志文件分割
程序员文章站
2022-06-06 14:44:59
linux tomcat下catalina.out日志文件分割
前言:
tomcat默认使用java.util.logging记录日志,默认只记录tomcat的日志,不...
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
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!