压缩包下载地址:
wget https://files.cnblogs.com/files/crazyzero/cronolog-1.6.2.tar.gz(我放在了/usr/local/src)
解压:
tar zxvf cronolog-1.6.2.tar.gz
进入解压目录:
cd cronolog-1.6.2
执行安装命令:
./configure
make
make install
查看安装路径:
which cronolog
默认路径为:/usr/local/sbin/cronolog
用cronolog将日志按照时间分割
找到tomcat/bin/catalina.sh 中
org.apache.catalina.startup.Bootstrap "$@" start \
>> "$CATALINA_BASE"/logs/catalina.out 2>&1 &
修改为
org.apache.catalina.startup.Bootstrap "$@" start 2>&1 \
|/usr/local/sbin/cronolog "$CATALINA_BASE"/logs/catalina.out.%Y-%m-%d.out>> /dev/null &
---------------------------------------------------------分割线--------------------------------------------------------------
着急看catalina.out日志怎么办?
①直接修改catalina.out文件名称②重启Tomcat