[slf4j-user] Per-web-app logging with jars on the ser ver's classpath

Ceki Gülcü listid at qos.ch
Mon Mar 19 19:59:02 CET 2007


Mark,

At 03:37 PM 3/17/2007, Mark Stralka wrote:

>Jake, I did some testing and have determined that logging to separate files
>works when I use Log4j.jar directly, but when I use JCL and SLF4j
>(jcl104-over-slf4j-1.3.0.jar, slf4j-api-1.3.0.jar, and 
>slf4j-log4j12-1.3.0.jar),
>the log entries only write to appA.log.  This is obviously a problem 
>because my
>real framework extends Spring, which uses JCL internally.

[snip]

>I'm going to look through SLF4j's implementation of the JCL interfaces to 
>see if
>I can just change the JCL interfaces to use Log4j directly... do you think
>that's correct?

The factory methods in adaptation layers, such as those in JCL, SLF4J or 
jcl-over-slf4j, short-circuit the RepositorySelector. You might want to 
consider a native SLF4J implementations such as logback [1] which 
incidentally offers a much better alternative to log4j's RepositorySelector 
in the form of ContextSelector [2].

Notwithstanding logback's direct implementation of SLF4J, the JCL or 
jcl104-over-slf4j adaptation layer will still circumvent your 
ContextSelector. Practically speaking, with jcl104-over-slf4j as 
implemented currently, context selection will not work. I will add a bug 
report so that we can fix this problem in future SLF4J releases.

HTH,

[1] http://logback.qos.ch/
[2] http://logback.qos.ch/manual/contextSelector.html


-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch




More information about the slf4j-user mailing list