tomcat日志配置

中文:

http://blog.sina.com.cn/s/blog_417b97470100g7f2.html

官方:

http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Access_Log_Valve

catalina.out按小时切割:

Linux下使用Cronolog轮循(rotating)Tomcat日志

首先安装cronolog(cronolog-1.6.2.tar.gz放于/opt下)

cd /opt

tar –zxvf cronolog-1.6.2.tar

cd cronolog-1.6.2

./configure --prefix=/usr/local/cronolog    //按自己需要指定安装路径,或不指定

make

make install

(2)修改Tomcat配置文件

先停止tomcat服务,然后修改以下文件:

%CATALINA_HOME%/bin/catalina.sh

org.apache.catalina.startup.Bootstrap "$@" start \

>> "$CATALINA_BASE"/logs/catalina.out 2>&1 &


替换为:

org.apache.catalina.startup.Bootstrap "$@" start 2>&1 \

| /usr/local/cronolog/sbin/cronolog "$CATALINA_BASE"/logs/catalina.%Y-%m-%d.out >> /dev/null &

另外删除行:

touch "$CATALINA_BASE"/logs/catalina.out

修改完毕后重新启动tomcat服务。 


你可能感兴趣的:(tomcat日志配置)