为什么 FINE 级别在 Java 日志文件中仍然给我 DEBUG 消息?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20248465/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why FINE level gives me still DEBUG messages in java log file?
提问by AkshaiShah
I have tried to change the logging.properties
file to:
我试图将logging.properties
文件更改为:
handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
1catalina.org.apache.juli.FileHandler.level = FINE
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.
2localhost.org.apache.juli.FileHandler.level = FINE
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.
3manager.org.apache.juli.FileHandler.level = FINE
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3manager.org.apache.juli.FileHandler.prefix = manager.
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.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler
# For example, to log debug messages in ContextConfig and HostConfig
# classes and to log only warnings and errors in other
# org.apache.catalina.** classes, uncomment these lines:
#org.apache.catalina.startup.ContextConfig.level = FINE
#org.apache.catalina.startup.HostConfig.level = FINE
#org.apache.catalina.level = WARNING
But for some reason, when I run my server, it is still outputting DEBUG logging such as:
但出于某种原因,当我运行我的服务器时,它仍然输出调试日志,例如:
> 16:50:01.849 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Finished creating instance of bean '(inner bean)#23'
There is no occurence of DEBUG
in logging.properties, so I'm not sure what is wrong.
DEBUG
在 logging.properties 中没有出现,所以我不确定出了什么问题。
Does anyone know what I have done wrong?
有谁知道我做错了什么?
回答by benjamin.d
Looking at your debug line, it seems that you are using logback
, and this line is related to a class in Spring. The log you see is not the tomcat one, but your application. Look for a logback.xml
file instead.
查看您的调试行,似乎您正在使用logback
,并且此行与 Spring 中的一个类有关。您看到的日志不是 tomcat 的日志,而是您的应用程序。logback.xml
而是查找文件。
回答by T0to
FINE is actually corresponding to DEBUG. If you want to for example INFO, you need to replace FINE by INFO.
FINE其实对应的是DEBUG。例如,如果您想要 INFO,则需要将 FINE 替换为 INFO。
You can find all the levels in that link: http://tomcat.apache.org/tomcat-6.0-doc/logging.html
您可以在该链接中找到所有级别:http: //tomcat.apache.org/tomcat-6.0-doc/logging.html