[logback-user] Context selectors useful?

Ceki Gulcu ceki at qos.ch
Thu Nov 27 10:41:28 CET 2008


Hello Holger,


Thank you for your response.  Bender Heri has described a similar use
case on the log4j-user list.

I believe that the problem you describe, namely separation of logging
(per thread), can be accomplished by means other than repository
selectors.

Assuming a new appender, say MultiAppender, was capable of embedding
and managing other appenders per thread basis, you would no longer
need context selectors. More importantly, most of the work would be
done by MultiAppender. You would only need to configure it in
logback.xml and push MDC values at the beginning of each thread. (I am
making the assumption that the MDC can be used to distinguish
threads.)

Needless to say, there is no intention of removing support for context
selectors.

Mense, Holger wrote:
> Hello,
> 
>> I am in the process of fixing bugs related to context selectors in
> logback. 
>> However, while sometime ago I thought that context selectors were the
> wave of 
>> the future, I am increasingly skeptical about their usefulness (of
> context 
>> selectors).
> 
>> If you are using context selectors, could you please explain why?
> 
> I am developing a multi threaded application, which can be executed all 
> together in one JVM or in several JVMs. In order to have the possibility
> of 
> different logback configurations and the same log behaviour in different
> runtime environments I am using my own ContextSelector, which 
> decides on behalf of the source thread, where the log request comes
> from, 
> which LoggerContext should be used for the log event.
> 
> So I would not like to see ContextSelector support gone in SLF4J or
> Logback.
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> Holger Mense                        Wincor Nixdorf International GmbH
> Banking Division                    Product Development (PSD5)
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user

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