So I just found out today that Log4J 2.0 is now actively being developed, there is an alpha version and it is said to replace logback.
Right now in my app I have close to 4 maybe more logging frameworks:
- Java Util Logging
- log4j
- slf4j
- logback (ignored thanks to a maven provided hack)
- commons logging (ignored thanks to a maven provided hack)
- And tomcat has its own JULI adapter
I have been using log4j (1.2.x) because frankly I just haven’t needed the features of the newer guys but I have been tempted lately to switch to SLF4J and mainly because I don’t want to have rewrite my complicated log4j configurations files to a new format (logback).
Now my question is in terms of what I should code against is SLF4J the right choice for the future given log4j 2.0.
It seems like I should just stick with old log4j (1.2.x) as it is the lowest common denominator?
UPDATE: on further examination of log4j 2.0 while very similar it appears the configuration is not backward compatible with log4j 1.2. Looks like logback is the best choice.
It’s a subjective question.
I’d suggest using slf4j, since it can use log4j as a backend if that’s what you need.
You’re likely to be using a number of components which may all use different logging APIs. It’s good to be able to consolidate the output via those APIs into a single output route.