本文发布于Cylon的收藏册,转载请著名原文链接~


修改logging.properties

/usr/local/apache-tomcat-8.5.32/conf/logging.properties
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = /data/logs
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.

2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = /data/logs
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.

3manager.org.apache.juli.AsyncFileHandler.level = FINE
3manager.org.apache.juli.AsyncFileHandler.directory = /data/logs
3manager.org.apache.juli.AsyncFileHandler.prefix = manager.

4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
4host-manager.org.apache.juli.AsyncFileHandler.directory = /data/logs
4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter

替换命令

:%s#${catalina.base}/logs#/data/logs#g
sed -i s#${catalina.base}/logs#/data/logs#g  /usr/local/apache-tomcat-8.5.32/conf/logging.properties

修改catalina.sh

CATALINA_OUT=/data/logs/catalina.out
JAVA_HOME=/usr/java/latest
JAVA_OPTS="${JAVA_OPTS} -Xms4096m -Xmx4096m -Xmn1024m -Xss1024K -XX:PermSize=4096m -XX:MaxPermSize=4096m"

增加如下

CATALINA_OUT=/data/logs/catalina.out
org.apache.catalina.startup.Bootstrap "$@" start  2>&1 \
      | /usr/sbin/cronolog /data/logs/catalina.%Y-%m-%d.out >> /dev/null &

本文发布于Cylon的收藏册,转载请著名原文链接~

链接:https://www.oomkill.com/2018/06/tomcat-log-path/

版权:本作品采用「署名-非商业性使用-相同方式共享 4.0 国际」 许可协议进行许可。