19

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?

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
Derek Mahar
  • 27,608
  • 43
  • 124
  • 174
  • 3
    Subjective and argumentative? Really? – Joachim Sauer Jun 15 '10 at 09:07
  • Does anybody use a logging framework other than Log4j and Logback? – Derek Mahar Jun 15 '10 at 19:35
  • 3
    Why the vote to close? This is hardly a subjective question. I'm asking for a factual list of Java logging libraries that work with Spring and Hibernate. I didn't even ask people to specify the relative strengths or merits of these libraries, let alone ask for the weaknesses of Log4j. How can this be considered subjective and argumentative? – Derek Mahar Jun 16 '10 at 19:25

2 Answers2

20

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.

Paul Gregoire
  • 9,715
  • 11
  • 67
  • 131
  • Can Spring and Hibernate use slf4j with Logback instead of Commons Logging with Log4j? – Derek Mahar Jun 15 '10 at 04:41
  • Yes, we use Spring + SLF4J + Logback in Red5 – Paul Gregoire Jun 15 '10 at 04:52
  • 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 – Paul Gregoire Jun 15 '10 at 04:53
  • 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 Jun 16 '10 at 16:46
  • @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 Jun 21 '10 at 15:38
  • @Mondain: Started using SLF4J and Logback and so far happy with the combination! – Derek Mahar Jun 22 '10 at 08:22
  • @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 Jun 22 '10 at 08:28
3

Java Source publishes a list of open source logging libraries.

Derek Mahar
  • 27,608
  • 43
  • 124
  • 174