如何设置tomcat日志

2016-04-12 03:50:26 8354

打开Tomcat目录conflogging.properties,修改如下,所有日志输出到tomcat开头的文件中

 1catalina.org.apache.juli.FileHandler.level = FINE

1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

# 1catalina.org.apache.juli.FileHandler.prefix = catalina.

1catalina.org.apache.juli.FileHandler.prefix = tomcat.

 

2localhost.org.apache.juli.FileHandler.level = FINE

2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

# 2localhost.org.apache.juli.FileHandler.prefix = localhost.

2localhost.org.apache.juli.FileHandler.prefix = tomcat.

 

3manager.org.apache.juli.FileHandler.level = FINE

3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

# 3manager.org.apache.juli.FileHandler.prefix = manager.

3manager.org.apache.juli.FileHandler.prefix = tomcat.

 

4host-manager.org.apache.juli.FileHandler.level = FINE

4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs

# 4host-manager.org.apache.juli.FileHandler.prefix = host-manager.

4host-manager.org.apache.juli.FileHandler.prefix = tomcat.

修改Tomcat运行日志的等级

3.1  日志类型与级别

Tomcat 日志分?下面5类:

catalina 、 localhost 、 manager 、 admin 、 host-manager

每类日志的级别分为如下 7 种:

SEVERE (highest value) > WARNING > INFO > CONFIG > FINE > FINER > FINEST (lowest value)

3.2  日志级别的设定方法

修改 conf/logging.properties 中的内容,设定某类日志的级别

示例:

 

设置 catalina 日志的级别为: FINE

1catalina.org.apache.juli.FileHandler.level = FINE

 

禁用 catalina 日志的输出:

1catalina.org.apache.juli.FileHandler.level = OFF

 

输出 catalina 所有的日志消息均输出:

1catalina.org.apache.juli.FileHandler.level = ALL

 


提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: