[slf4j-user] Per Web App logging

Ceki Gülcü listid at qos.ch
Mon Nov 20 21:42:41 CET 2006


Hi Amir,

At 09:32 PM 11/20/2006, Amir Mistric wrote:
>Hello Everyone
>
>My company would like to try SLF4J as a replacement for Log4J.
>Currently we use JBoss AS 4.x and the problem we had was that we could not 
>configure logging “per web application”.
>We ended up using RepositorySelector trick in order to be able to have a 
>separate log4j.xml in every web application deployed.
>This approach, however, requires each web app to have a copy of log4j.jar 
>in its WEB-INF/lib



If you use the JNDI-based repository selector, you can place a single 
log4j.jar in the containers shared class loader. I am a little surprised 
that you need to copy log4j.jar in each web-app. Can you please elaborate?

>Recently we decided to create a shared library repository for all web apps 
>we have.
>While this approach has reduced the “baggage” each web app had in its 
>WEB-INF/lib we still have to use log4j.jar 
.
>
>Our goal is simple. Have every web application running on the same app 
>server have its own logging config file but share the single JAR (or jars).

Not yet, but it's core feature planned in one of the next releases of logback.

>Can SLF4J accomplish this (using built in logback classic) for us?

No, SLF4J is just a front for logback/jul/log4j/jcl. While SLF4J cannot 
accomplish what you are asking, log4j can do so, and logback will in the 
near future.

>Thanks
>Amir

-- 
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