The log4j is working fine, however, at server startup, I am getting these warnings:
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
It's implying the log4j.properties
could not be found. But I am not sure how to fix that because everything seems to be working fine.
Why do I see a warning about "No appenders found for logger" and "Please configure log4j properly"? This occurs when the default configuration files log4j. properties and log4j. xml can not be found and the application performs no explicit configuration.
Place the spring Log4jConfigListener as the first listener in your web.xml.
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
You set upp the location of the log4j properties in a context-param but you do not need to do this if it is placed on the classpath.
An example is ..
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/resources/log4j.properties</param-value>
</context-param>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With