1.Cronolog下载
https://directory.fsf.org/wiki/Cronolog
2.Cronolog安装
解压、进入
# tar zxvf cronolog-1.6.2.tar.gz
# cd cronolog-1.6.2
编译、安装
# ./configure
# make
# make install
查看cronolog安装后所在目录(验证安装是否成功)
# which cronolog
查找cronolog命令的位置(which cronolog)
安装成功,默认是安装在/usr/local/sbin/下。(/usr/local/sbin/cronolog)
3.Tomcat配置
3.1.catalina.sh文件位置
3.2.修改内容
1)touch "$CATALINA_OUT"注释掉
2)org.apache.catalina.startup.Bootstrap "$@" start \
>> "$CATALINA_OUT" 2>&1 "&"
换成
org.apache.catalina.startup.Bootstrap "$@" start 2>&1 \
|/usr/local/sbin/cronolog "$CATALINA_BASE"/logs/catalina.%Y-%m-%d.out >> /dev/null &
3.3.注意事项
1.连接符\后不能留空格
2.org.apache.catalina.startup.Bootstrap "$@" start \
>> "$CATALINA_OUT" 2>&1 "&"
删掉这两行,而不是注释掉
否则报错:
/home/tomcat/apache-tomcat-7.0.85/bin/catalina.sh:line448:org.apache.catalina.startup.Bootstrap: command not found
来源:oschina
链接:https://my.oschina.net/u/2745117/blog/1630495