[logback-user] Setting log levels per context

Daniel López D.Lopez at uib.es
Tue May 14 09:26:08 CEST 2013

Hi there,

I have been able to separate the different logs of differents web 
applications in a shared host using a sift appender like this one:

<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">

   <appender name="FILE-${contextName}" 

And so far, it works great. My question now would be if it is possible 
to set different levels for the different contexts in an easy way. I 
know I can copy the library on each application and use a different 
configuration file per webapp (not using logback for the global Tomcat 
then) and I have been able to use Filter to simulate the level setting 
per context by setting the level to the Max and then filtering out the 
levels by context... but I was wondering if there is no easier way to do 
it, as adding filter code for each webapp makes the configuration look 
fragile and bloated. I have 28 small-medium apps in this host, so that's 
why I'm trying to find the simplest way :).

So I guess I'm looking for something like..

<logger name="org.whatever" level="INFO" context="MyApp"...>

Does something like that exist and I was unable to find it? If no, do 
you think it would be intesting? I might give it it shot if that's the case.

Daniel Lopez Janariz (D.Lopez at uib.es)
Web Services
Balearic Islands University

More information about the Logback-user mailing list