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

修改logging.properties

1
/usr/local/apache-tomcat-8.5.32/conf/logging.properties
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
############################################################
# 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

替换命令

1
2
:%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

1
2
3
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"

增加如下

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

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

链接:tomcat修改日志目录

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