linux修改tomcat日志文件路径

tomcat默认的日志文件在 logs 目录下,如果我们要修改日志文件存放路径,需要以下两个步骤

  1. 修改 tomcat 下 conf 文件夹中的 logging.properties 文件,将 ${catalina.base} 修改为你想要存放的路径
1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = /home/gavin/backup/logs
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 = /home/gavin/backup/logs
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 = /home/gavin/backup/logs
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 = /home/gavin/backup/logs
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
  1. 以上配置无法修改 catalina.out 的存放路径,要修改 catalina.out 的路径,需要修改tomcat下 bin 目录中的 catalina.sh 文件,vim catalina.sh 编辑文件,修改 CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out
CATALINA_OUT=/home/gavin/backup/logs/catalina.out

之后保存退出并重启tomcat,日志文件就修改成功啦!

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 黑客帝国 设计师:白松林 返回首页