I know that the common opinion is that Logback > log4j. Still, is there anything log4j does better than Logback? Any reason to use log4j over logback? How about the fact it only has 60 questions on stack overflow, so I presume a much smaller user base?
Asked
Active
Viewed 2,623 times
2 Answers
14
Take a look at official opinion. log4j isn't under active development anymore, and since logback is being developed ground up by the same author as log4j, Ceki Gülcü, to correct some mistakes made in log4j's development, you can be pretty sure that using logback isn't a bad idea.

darioo
- 46,442
- 10
- 75
- 103
-
It's by the same author? I see. "Given that logback builds upon on our previous work on log4j, simply put, logback is just a better log4j". – ripper234 Nov 30 '10 at 06:47
-
12Ceki Gülcü is the main author behind log4j, slf4j and Logback. Why so many different projects? Well, Ceki lost creative control over log4j after its astronomic success @ Apache and worldwide. The API needed to stabilize, and the impl needed to harden -- by sheer necessity. To make improvements to log4j conceptually, Ceki was forced to start new projects (conceptual forks), where API improvement and deprecation would not be so disruptive. – Mike Clark Nov 30 '10 at 06:55
3
No matter what logging backend you choose, I suggest using slf4j as a frontend to it. It may seem like overkill, but in these times of dependency injection and abstraction, having a simple layer between you and the logging impl isn't so crazy.
As noted by Ceki, Logback's public API actually is slf4j, so if you choose Logback and use it in the recommended way, you are already using slf4j.

Community
- 1
- 1

Mike Clark
- 10,027
- 3
- 40
- 54
-
I know this already, and this isn't really an answer to my question (should rather be a comment instead) – ripper234 Nov 30 '10 at 07:20
-
1@ripper234 - the answer that you accepted isn't a real answer to your question either. A real answer would be either "No", or a list of reasons why "log4j" might be a better idea. – Stephen C Nov 30 '10 at 07:49
-
1@Stephen - if logback is by the same author, and log4j development has stopped, that's a resounding No in my book. – ripper234 Nov 30 '10 at 08:24
-
1@ripper234 - but it does not answer your question. Your question asks if there is something that Log4j >>does<< better. My meta-point is that if you are going to make comments that someone's answer is "not really an answer" ... you should be consistent. Or better still, just be quiet. As the saying goes, "don't look a gift horse in the mouth." – Stephen C Nov 30 '10 at 08:45
-
2