[logback-user] Context selectors useful?

Ceki Gulcu listid at qos.ch
Thu Nov 27 11:05:43 CET 2008



Lars Ködderitzsch wrote:
> Hello Ceki,
> 
> thanks for the heads up on this issue on the mailing list.
> 
> Starting off I'd like to mention that for me the most wanted feature is
> separation of logging from different contexts (e.g. war's, ejb) of of an
> enterprise application (ear), without needing to resort to classloader
> stunts, multiple repeated logging configurations etc.

> That means that the contexts of an enterprise app should be able to use
> the same logging implementation (that is placed in the ear classloader)
> and the same logging configuration, but ultimately the log into
> different log files.
> This way it can be truely sorted out, which context logged which message.
> 
> To my knowledge such a thing is supported in neither logging
> implementations.
> Currently I am running this as a hack on log4j, based on a specialized
> appender which switches the underlying log file based on some thread
> local, which in turn is set by a special servlet filter in each web context.

Switching log files can be accomplished by a new appender which can embed and 
manage appenders based on MDC values.

> If your're interested I can elaborate more on the problem, so you can
> get a better understanding what would actually be needed.

Additional detail would be nice. For example, how are you managing thread local 
values in the web-app and in ejbs?



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


More information about the Logback-user mailing list