[英]Does log4j2 warn if no configuration file is found?
I have no log4j2 configuration files defined in my classpath. 我的classpath中没有定义log4j2配置文件。 My log messages are still going to the console and I see no warning about a missing configuration. 我的日志消息仍然会进入控制台,我看不到有关丢失配置的警告。
I am running a servlet based application on Tomcat 7. 我在Tomcat 7上运行基于servlet的应用程序。
I'm trying to figure out how it is getting this configuration? 我想弄清楚它是如何获得这种配置的?
I am expecting to see the warning in log4j2 like you would see in log4j. 我希望在log4j2中看到警告,就像你在log4j中看到的那样。
Log4j2 can autoconfigure itself if you do not provide a config file. 如果您不提供配置文件,Log4j2可以自动配置。
Configuration of Log4j 2 can be accomplished in 1 of 4 ways: Log4j 2的配置可以通过以下四种方式之一完成:
http://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration http://logging.apache.org/log4j/2.x/manual/configuration.html#AutomaticConfiguration
I am using Tomcat. 我正在使用Tomcat。 When I removed the log4j2.xml file This is the message that I see when the web server starts: 当我删除log4j2.xml文件时这是我在Web服务器启动时看到的消息:
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Since the severity is ERROR, the message is indeed quite visibile. 由于严重性为ERROR,因此该消息确实非常可见。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.