利用cronolog对Tomcat7catalina.out日志分割

coding

下载

Download

解压后安装

[root@ ~]# tar -xzvf cronolog-1.6.2.tar.gz

[root@ ~]# cd cronolog-1.6.2

[root@ ~]# ./configure

[root@ ~]# make && make install

[root@ ~]# which cronolog

/usr/local/sbin/cronolog

编辑catalina.sh

编辑前先备份一个

[root@ bin]# cp catalina.sh catalina.sh.bak

修改点

[root@ bin]# diff catalina.sh catalina.sh.bak 

186c186

< CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out.%Y-%m-%d

---

> CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out

371c371

< #touch "$CATALINA_OUT"

---

> touch "$CATALINA_OUT"

384c384,385

< org.apache.catalina.startup.Bootstrap "$@" start 2>&1 | /usr/local/sbin/cronolog "$CATALINA_OUT" >> /dev/null &

---

> org.apache.catalina.startup.Bootstrap "$@" start \

> >> "$CATALINA_OUT" 2>&1 "&"

392c393,394

< org.apache.catalina.startup.Bootstrap "$@" start 2>&1 | /usr/local/sbin/cronolog "$CATALINA_OUT" >> /dev/null &

---

> org.apache.catalina.startup.Bootstrap "$@" start \

> >> "$CATALINA_OUT" 2>&1 "&"

重启Tomcat即可

以上是 利用cronolog对Tomcat7catalina.out日志分割 的全部内容, 来源链接: utcz.com/z/509915.html

回到顶部