commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <>
Subject Re: [crypto] Logging dependency
Date Thu, 09 Jun 2016 23:17:51 GMT

> On Jun 9, 2016, at 3:55 PM, James Carman <> wrote:
> On Thu, Jun 9, 2016 at 2:19 PM Matt Sicker <> wrote:
>> There is a huge list of advantages to using log4j-api over slf4j-api
>> nowadays, plus I do prefer to use Apache dependencies in Apache projects
>> unless the competition is clearly better for the use case (like using Jetty
>> instead of Tomcat in Karaf due to OSGi support). Also, using log4j-api
>> works fine with logback as well, so it's not like it prevents people from
>> using slf4j bindings at runtime.
> It's just my personal preference.  I have grown used to it and use it so
> much.  In Karaf (where I spend most of my time these days), I don't even
> have to think about it.

That is understandable. But you should really compare the APIs. Just as SLF4J is much better
than Commons Logging, so too is Log4j’s API much better than SLF4J’s - at least in the
opinion of those who develop Log4j. 

Also, SLF4J advertises 2 key features - parameterized log statements and Markers.  However,
SLF4J markers are a mess. The code isn’t thread safe and has terrible performance (which
you can see on the Log4j performance page). Log4j also supports parameterized logging, but
it also supports using printf style strings, MessageFormat strings as well as logging Messages
instead of Strings. And, of course, it supports Lamda’s, which goes even further into not
needing to wrap logging statements in if isEnabled checks.

And as Gary mentioned, we intentionally created a bridge from Log4j’s API to SLF4J for those
who want to use some other implementation.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message