linux tomcat标准日志分割

1. 下载日志分割程序:

wget  https://files.cnblogs.com/files/crazyzero/cronolog-1.6.2.tar.gz

md5(a44564fd5a5b061a5691b9a837d04979)

2. 安装分割程序:

./configure

make

sudo make install

which cronolog

 

2. 修改tomcat启动脚本vim catalina.sh(大概在catalina文件中的第429行和第439行左右)

   
1)  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" &

 

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" &

 

你可能感兴趣的:(java)