Linux Tomcat9 catalina.out日志按日期生成

#Linux Tomcat9 catalina.out日志按日期生成

  1. yum install cronolog
  2. 查看 cronolog 安装 which cronolog
  3. 备份tomcat/bin/catalina.sh
  4. 修改 catalina.sh

  


# 226行
if [ -z "$CATALINA_OUT" ] ; then
CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out
fi
#修改为
=======>
if [ -z "$CATALINA_OUT" ] ; then
CATALINA_OUT="$CATALINA_BASE"/logs/catalinaLog.%Y-%m-%d.out
fi

#460 行,删除或者注释掉
=======> #touch "$CATALINA_OUT"

#474行和484行两处修改
org.apache.catalina.startup.Bootstrap "$@" start \
>> "$CATALINA_OUT" 2>&1 "&"
=======>
org.apache.catalina.startup.Bootstrap "$@" start 2>&1\
| /sbin/cronolog "$CATALINA_BASE"/logs/catalinaLog.%Y-%m-%d.out >> /dev/null &
#从新启动tomcat

 

上一篇:Tomcat 日志配置


下一篇:Tomcat多实例和负载均衡(我希望起身时,你会轻轻帮我弹掉衣服上不容易发现的灰尘。我希望写字时,手边的可乐一直是我喜欢的温度。)