[logback-user] Log separation

Ralph Goers rgoers at apache.org
Thu Apr 29 10:43:17 CEST 2010

Sorry, I've never used the SiftingAppender. Just read the doc for it.  Yes, they are similar and it is a better approach. Although the doc mentions using it for static loggers it occurs to me that it is probably also useful if all the web apps are configured to use the same config file even if all the jars are in the web app.

On Apr 29, 2010, at 1:27 AM, Ceki Gülcü wrote:

> On 29/04/2010 9:33 AM, Ralph Goers wrote:
> > What you are asking to do can be done by having a logger for the
> > classes in the common jar (presumably they are all using the same
> > package name at some level) that is configured with 2 appenders. Each
> > appender is then configured with a filter so that it only allows data
> > from the relevant webapp to be written to that particular file. If you
> > are capturing the request URL or something else that identifies the
> > particular webapp and placing it in the MDC then you can use the
> > EvaluatorFilter (or write your own) to do the filtering.
> That's essentially what SiftingAppender does. Note that your solution
> suffers from the same exact contention problem that Edwin seems to
> dislike. Also in [1] you only need to configure one SiftingAppender
> per web-app and it will transparently deal with the order in which
> web-apps are started. In your approach, either you have to elect one
> web-app, say ADAM, to start first and in ADAMS's logback.xml configure
> one additional appender per web-app. Whenever a webb-app is added you
> would need to adapt ADAM's web-app by hand. If you can't elect a
> web-app to start first, then you would need to add an appender per
> web-app in each web-app by hand which would be horrible to maintain
> beyond two web-apps.
> The solution described in [1] is not so different than yours, except
> that it automates a lot of the grunt work.
> [1] http://logback.qos.ch/manual/loggingSeparation.html
> --
> Ceki
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user

More information about the Logback-user mailing list