不要登录catalina.out

时间:2010-08-06 14:04:21

标签: java tomcat logging

我有以下logging.properties配置:

1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = /mnt/asd/tomcat_logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.

2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = /mnt/asd/tomcat_logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.

3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = /mnt/asd/tomcat_logs
3manager.org.apache.juli.FileHandler.prefix = manager.

4host-manager.org.apache.juli.FileHandler.level = FINE
4host-manager.org.apache.juli.FileHandler.directory = /mnt/asd/tomcat_logs
4host-manager.org.apache.juli.FileHandler.prefix = host-manager.

在文件夹/ mnt / asd / tomcat_logs中有以下文件:

  • catalina.2010-08-06.log
  • 主机manager.2010-08-06.log
  • localhost.2010-08-06.log
  • manager.2010-08-06.log

但是在 / etc / tomcat / tomcat / log 文件夹中还有 catalina.out 文件。如何将文件路径更改为/ mnt / asd / tomcat_logs ??

5 个答案:

答案 0 :(得分:5)

修改 conf / logging.properties 并更改:

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

通过

.handlers = 1catalina.org.apache.juli.FileHandler

答案 1 :(得分:3)

答案 2 :(得分:2)

以上方法是正确的,但请不要更改现有的sh文件,请创建新的" $ CATALINA_BASE / bin / setenv.sh"文件并添加此条目:

导出CATALINA_OUT =" /new/path/to/catalina.out"

不要忘记chmod + x" $ CATALINA_BASE / bin / setenv.sh"。

对于Windows,请使用其setenv.bat对应文件。

答案 3 :(得分:1)

您必须编辑“$ CATALINA_BASE”/bin/catalina.sh文件并找到CATALINA_OUT =“$ CATALINA_BASE”/logs/catalina.out并替换为新路径。

重启tomcta并享受它。

答案 4 :(得分:0)

您可能会在某处覆盖logging.properties文件,因此您必须检查:

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
1catalina.org.apache.juli.AsyncFileHandler.level = FINE
1catalina.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.

2localhost.org.apache.juli.AsyncFileHandler.level = FINE
2localhost.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.

3manager.org.apache.juli.AsyncFileHandler.level = FINE
3manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.AsyncFileHandler.prefix = manager.

4host-manager.org.apache.juli.AsyncFileHandler.level = FINE
4host-manager.org.apache.juli.AsyncFileHandler.directory = ${catalina.base}/logs
4host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.

java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter