commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raman Gupta <>
Subject Re: [logging] logging vs slf4j
Date Mon, 08 Aug 2011 19:03:52 GMT
On 08/08/2011 02:00 PM, ralph.goers wrote:
> On Mon, Aug 8, 2011 at 8:06 AM, Simone Tripodi <>wrote:
>>>> If we really have to reconsider this stuff, then I'd propose to
>>>> a) Use java.util.logging, because it doesn't require any additional
>>>> dependencies and is guaranteed to work anywhere.
>>>> b) Carefully document how to bridge jul to log4j, because that's
>>>> exactly what's required in almost any application container I am aware
>>>> of. (The exception being Tomcat, which uses jul anyways.)
>>>> c) If the slf4j fans insist, add similar documentation for bridging
>>>> jul to slf4j.
>>> +1. I like this plan.
>> +1 I like this plan too. it sounds *very* reasonable: unified,
>> standard (?) way to log, easy to bridge to everything needed.
>> can we ask more?
>> have a nice day, all the best!!!
>> Simo
> I'm not a fan of this plan. Have you actually tried to "bridge" jul to
> anything?  While it will work anywhere that doesn't imply it will work
> properly.
> Ralph

I'm not a fan of this plan either. Jul bridging is not simple because
JUL doesn't provide the necessary hooks, and packages under the java.*
namespace can't be replaced.

For example, see this slf4j page:

To quote one relevant sentence:

"...Consequently, j.u.l. to SLF4J translation can seriously impact on
the cost of disabled logging statements (60 fold increase) and a
measurable impact on enabled log statements (20% overall increase)."

Logging to Logback via slf4j does provide a work-around to the above
performance problem (LevelChangePropagator) but other frameworks may
not (log4j?), and in general configuring the JUL bridge is much harder
than it should be, and many users will get it wrong. Other frameworks
may have similar issues bridging JUL as well.

Perhaps I'm missing something, but what exactly is wrong with simply
using slf4j? It is an extremely simple, widely used library that
provides out of the box hooks for many logging frameworks including
log4j and logback, simple to configure (i.e. drop the appropriate jars
in and thats it), and works out of the box in an OSGi environment? The
only downside appears to be that it is not an Apache project. So what.


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

View raw message