白云岛资源网 Design By www.pvray.com

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

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

白云岛资源网 Design By www.pvray.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
白云岛资源网 Design By www.pvray.com