[slf4j-user] JUL to SLF4J

Christian Stein sormuras at gmx.net
Mon Mar 12 10:51:04 CET 2007


Boris Unckel schrieb:
> Hello Christian,
>>   Driven by need (and already startet this discussion here [1]),
>>   I'd like to know, how to capture and redirect JUL[2] log calls
>>   over to SLF4J.
>>
>>   Am I missing something? Is it possible?
>>
> This is easy for smart clients where just the system classloader is loading all necessary classes. In Java EE environments you would have to put the JUL classes which do the redirect, SLF4J api and SLF4J implementation and the needed logging backend (like log4j or logback) on the system classpath.
> This is possible in some Java EE environments but not very nice...
> 
> Have a look at www.x4juli.org it does implement SLF4J, JCL (naturally JUL) natively and has a System.out / System.err redirect capability.
> The sample WAR in x4juli is corrupt, I had no time to fix it.
> 
> Regards
> Boris

Thanks for the answer, Boris and sorry for my late reply.

Using a -D system switch seems ... ugly to me. I like the idea, how
SLF4J and implementations are deployed. The first one found in the
user classpath is used.

Another (*shiver*) approach would be, de-registering all default
JUL logger handler and install a SLF4J using the JUL manager. No, not
really a solution: at which time would one do the replacement?

A lightweight solution shipping with SLF4J like mentioned here, would
be great: http://bugzilla.slf4j.org/show_bug.cgi?id=38 ... even it
uses the -D thing.

Cheers,
Christian



More information about the slf4j-user mailing list