1,安装cronolog
# wget # tar xvzf cronolog-1.6.2.tar.gz # cd cronolog-1.6.2 # make # make install
安装成功后 运行which cronolog会找到对应的路径 /usr/local/sbin/cronolog
2,修改tomcat的catalina.sh文件
在tomcat的bin目录的catalina.sh中找到2行:
org.apache.catalina.startup.Bootstrap “[email protected]” start \
>> “$CATALINA_BASE”/logs/catalina.out 2>&1 &
修改为
org.apache.catalina.startup.Bootstrap "[email protected]" start 2>&1 \
| /usr/local/sbin/cronolog "$CATALINA_BASE"/logs/catalina.%Y-%m-%d.out >> /dev/null &
上面会有一行touch “$CATALINA_BASE”/logs/catalina.out
把其注释掉即可。
时间: 2024-10-29 04:44:50