Mar 9, 2009

Enable Debug Level For SLF4J

To my shame, I'm absolutely new to logging in Java, and so far I've gone as far as “you need to add this to enable debug-level logging in your application”:

log4j.rootLogger=DEBUG, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n


The exact problem was that despite having that configuration, I actually didn't see any debug printouts emitted by one of the libraries I was using, just the info ones. The reason was that library used SLF4J and was bound to the SLF4J-Simple logger.

Since I had no time to go ahead and read through the whole SLF4J manual, what I did was removing slf4j-simple.jar and including slf4j2log4j.jar instead.

And all the debug messages were there.

1 comment:

Simeon said...

Could you tell me where to find this slf4j2log4j.jar ?