views:

191

answers:

2

What logging libraries do you recommend as alternatives to Log4j? Do these libraries work with Spring and Hibernate? Are they compatible with Slf4j or Jakarta Commons Logging?

+10  A: 

slf4j allows you to use just about all the other logging frameworks at once. Juli, Commons, Log4j etc.. As an output framework to use with slf4j instead of Log4j, I would suggest Logback http://logback.qos.ch/ which is written and maintained by the creator of Log4j.

Mondain
Can Spring and Hibernate use slf4j with Logback instead of Commons Logging with Log4j?
Derek Mahar
Yes, we use Spring + SLF4J + Logback in Red5
Mondain
I'm sure this is more info than you need and it is Red5 specific, but it may help explain what to do:http://www.red5.org/wiki/Documentation/Tutorials/LoggingSetup
Mondain
Judging from the number of votes for this answer and the absence of any other specific responses, it seems that the combination of slf4j and Logback is now the dominant alternative to Log4j.
Derek Mahar
@Mondain: I learned that in order to Commons Logging with SLF4J, Spring 2.5.6 requires bridging jarfile `jcl-over-slf4j.jar`. See http://www.slf4j.org/legacy.html#jcl-over-slf4j.
Derek Mahar
@Mondain: Started using SLF4J and Logback and so far happy with the combination!
Derek Mahar
@Mondain: Looks like many other Stack Overflow users agree with you: http://stackoverflow.com/questions/178836/should-new-projects-use-logback-instead-of-log4j.
Derek Mahar
A: 

Java Source publishes a list of open source logging libraries.

Derek Mahar