关于tomcat:tomcat8-日志路径乱码自动分割-问题解决

38次阅读

共计 1567 个字符,预计需要花费 4 分钟才能阅读完成。

日志乱码

vim catalina.sh

  • 在如图所示处 增加 -Dfile.encoding=UTF-8

JAVA_OPTS="$JAVA_OPTS -Djava.protocol.handler.pkgs=org.apache.catalina.webresources -Dfile.encoding=UTF-8"  

日志门路

vim catalina.sh

  • 在如图所示批改 CATALINA_OUT=
if [-z "$CATALINA_OUT"] ; then
  #CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out
  CATALINA_OUT=/data/WEBLOG/uat-ecommerce-app/catalina.out
fi

日志主动宰割

  • [root@tomcat-uata_20 conf]# vim logging.properties

1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = /data/WEBLOG/uat-ecommerce-app
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.
1catalina.org.apache.juli.AsyncFileHandler.encoding = UTF-8

2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = /data/WEBLOG/uat-ecommerce-app
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.
2localhost.org.apache.juli.AsyncFileHandler.encoding = UTF-8

3manager.org.apache.juli.AsyncFileHandler.level = FINE
3manager.org.apache.juli.AsyncFileHandler.directory = /data/WEBLOG/uat-ecommerce-app
3manager.org.apache.juli.AsyncFileHandler.prefix = manager.
3manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8

4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
4host-manager.org.apache.juli.AsyncFileHandler.directory = /data/WEBLOG/uat-ecommerce-app
4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.
4host-manager.org.apache.juli.AsyncFileHandler.encoding = UTF-8

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = org.apache.juli.OneLineFormatter
java.util.logging.ConsoleHandler.encoding = UTF-8

正文完
 0