Java, Spring, Log4j, Web – Can’t see logs during context initialization

Using: Spring, Log4j, Web, Backend.

So many times I have seen:

log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.

 

Solution is always very simple – think and check your web.xml file:

    <listener>
        <listener-class>
            org.springframework.web.util.Log4jConfigListener
        </listener-class>
    </listener>

	<listener>
		<listener-class>
			org.springframework.web.context.ContextLoaderListener
		</listener-class>
	</listener>

 

Logging has to be initialized before context in your application. So if you have problems during development, that can’t in easy way track the errors with “errorListenerStart”, look up if logging is initialized first.

 

Posted in: Sortware

Tagged as:

Advertisements

Leave a Reply

Be the First to Comment!

Leave a Reply

  Subscribe  
Notify of