Visitors are also reading...
← PreviousNext →

Setting up log4j in a maven project

21 Aug 2010

I always forget how to quickly set up log4j in my maven project, even though it is really easy.

I keep getting

log4j:WARN No appenders could be found for logger (mogi.code.reflection.Utils).
log4j:WARN Please initialize the log4j system properly.

So if you get this too, and all you want is to get things printed to your console, all you need to do is add a file under src/main/resources folder and populate it with the following text

log4j.rootLogger=DEBUG, A1

# Print the date in ISO 8601 format  
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n  

# Print only messages of level WARN or above in the package

after that you should start seeing your log on console.
read more about log4j

← PreviousNext →