安装cronolog
shell> sudo yum install cronolog
或
shell> sudo apt-get install cronolog
验证cronolog:
shell> which cronolog
源码安装
shell> wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
或者在百度云盘下载:
链接: https://pan.baidu.com/s/14vRoQ1WEt95eMKXFw0u06A 提取码: v3b2
下载完成:
shell> tar zxf cronolog-1.6.2.tar.gz
shell> cd cronolog-1.6.2
shell> ./configre
shell> make
shell> make install
验证cronolog:
shell> which cronolog
源码安装时先执行:yum install gcc gcc-c++ gcc-g77
修改tomcat配置文件
catalina.sh文件在tomcat的bin目录下
shell> vim catalina.sh
注释掉:
#touch "$CATALINA_OUT"
修改:
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 &
重新启动tomcat生效
tomcat下的logs文件有 catalina.2018-12-10.out类似的文件。