|
|
|
|
|
by pointyhat
5380 days ago
|
|
This is the typical result of "enterprise" applications which are more interested in decoupling the logging system from the framework versus picking one that works. Over-abstraction at work. There is a "commons logging" for .Net as well which replicates the entire log4net API 1:1. That is where the crazy starts to set in. |
|
log4j was the first de facto standard (excluding System.out). Making it part of the standard API would have been a no-brainer. Unfortunately, java.util.logging sucks (hard to customize, coupling with J2EE app servers). So people keep using log4j.
Library writers now have a problem: How do you choose which logging framework to use? You really want to use the same framework as your users, the developers making apps. Thus was born commons-logging.
commons-logging has a number of problems, including non-deterministic setup and being bundled with some common app servers (which creates its own share of problems).
Thus: slf4j. Which works.
I agree with the author that slf4j is the way to go. Alternatively you can just use log4j directly. But slf4j has one feature which log4j doesn't: format strings. If you've ever had to add "if (log.isDebuggingEnabled())" checks to logging code you'll appreciate what a difference this makes.
In conclusion: Java logging is a clusterfuck, but if you know what to use you'll be fine. The end.