Monday, February 15, 2010

Solving Error - log4j:WARN No appenders could be found for logger

This log4j error is probably the simplest and most common problem ever encountered in Java EE development history.

log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
Actually it's not even a real problem, but it can be confusing at first. Understandably so because the error message doesn't give any hint over how to "initialize the log4j system properly".

Fortunately, it's very easy. Just save the following code as Put it inside your classpath root that is WEB-INF/classes. If you're using Maven that would be src/main/resources.

log4j.rootLogger=info, R
log4j.appender.R.layout.ConversionPattern=%-5p %-30.30c{1} %x - %m%n


Christian Schneider said...

For maven I would recommend to save the file to src/test/resources. So it is active in eclipse and for maven tests but does not go into the jar.
For production use the should be at a place on the classpath where you can change it easily.

Anonymous said...

Thank you! very simple and very helpful!

Захари Палазов said...

Thanks a lot, easy and usefull!

saleem said...

thanks... its very helpfull

Charith said...

thanks a lot

ingmmurillo said...

Thank you!!!

Christian said...

+1 -- I had nighmarish issues trying to figure out why my WS wasn't loading when I included my dao. I got absolutely not output but I knew it was spring-autowired related

CainLara said...

Thank you very much. Quite helpfull. But there is something still which makes me wonder, what about moving to production ? where should it really be located ?

polo outlet said... Burberry Outlet Air Max Shoes Coach Black Friday Coach Black Friday Coach Cyber Monday Coach Factory Coach Outlet Factory Coach Outlet USA Coach Purses Factory Coach Purses USA Coach Store Outlet Coach Purses On Sale Monster Beats Outlet Louis Vuitton Outlet Louis Vuitton Factory Marc Jacobs On Sale MCM Outlet MCM 店铺 cheap oakley sunglasses Michael Kors Outlet Michael Kors Outlet Michael Kors Factory Michael Kors Outlet Michael Kors Factory Online Coach Factory Outlet North Face Outlet Online Polo Outlet Store Ralph Lauren UK Sac Longchamp Pairs Coach Outlet Online Coach Factory Oultet Barbour Jackets Outlet Online Canada Goose Outlet Gucci Outlet Online Michael Kors Outlet Moncler Clearance Moncler Jackets Outlet Online North Clearace Outlet Polo Ralph Lauren Outlet Online Woolrich Clearance Michael Kors Factory Outlet Coach Outlet Online USA Beats by Dre Coach Purses Outlet Online Michael Kors USA

Getit said...

Lovely information. Download Zapya for PC, Zapya free download, Zapya download, Zapya apk to share files and folders

Post a Comment

Copyright 2009 Spring vs Java EE Web Dev. Powered by Blogger Blogger Templates create by Deluxe Templates. WP by Masterplan