下载
解压后安装
[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即可
来源:oschina
链接:https://my.oschina.net/u/588736/blog/1797807