Linux tomcat分割catalina.out

tomcat分割catalina.out

1.登录http://cronolog.org/下载cronolog-1.6.2.tar.gz
2.运行 tar -xvf cronolog-1.6.2.tar.gz解压
3.cd cronolog-1.6.2
4.依次运行./configure、make、make install安装
5.运行which cronolog看是否安装成功,一般在/usr/local/sbin/cronolog
6.编辑tomcat/bin/catalina.sh
7.注释#touch "$CATALINA_OUT"
8.修改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 &

-security下是否修改看情况


9.定期转移、删除日志
find /test/ -mtime +10 -name "*" | xargs -i mv {} /test2/

find /test/logs -mtime +60 -regex '.*.log\|.*.out\|.*.txt' -exec rm -fv {} \;

相关推荐