tomcat 使用 cronolog 切割日志

1. 下载 cronolog 软件

wget http://cronolog.org/download/cronolog-1.6.2.tar.gz
cronolog-1.6..tar.gz
tar zxvf cronolog-1.6..tar.gz
cd cronolog-1.6.
./configure && make && make install

2. 编辑 tomcat   catalina.sh 文件

2.1 查找

if [ -z "$CATALINA_OUT" ] ; then

  CATALINA_OUT=/opt/htdocs/logs/catalina.out

fi

修改为

if [ -z "$CATALINA_OUT" ] ; then

  CATALINA_OUT=/opt/htdocs/logs/catalina.%Y-%m-%d.out

fi

2.2 查找

touch "$CATALINA_OUT"

修改为

#touch "$CATALINA_OUT"

2.3 查找

"$CATALINA_OUT" >& "&"

有两处

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

      >> "$CATALINA_OUT" >& "&"

都修改

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

      | /usr/local/sbin/cronolog "$CATALINA_OUT" >> /dev/null &
上一篇:Python简单的验证码生成


下一篇:python爬虫20 | 小帅b教你如何使用python识别图片验证码