1. 程式人生 > >linux tomcat標準日誌分割

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 "

[email protected]" start \
       >> "$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" &

 

2)  org.apache.catalina.startup.Bootstrap "[email protected]" start \
      >> "$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" &