[logback-user] SocketAppender application property

Ralph Goers rgoers at apache.org
Wed Aug 19 01:24:15 CEST 2009


As I hope the example on the web site shows, this can be used for more  
than just the single value. Configuring the value in logback.xml would  
let you configure static values but not items like those shown in the  
example. I think it makes more sense to try to set the values all in  
one place - in the case of the example, a Servlet Filter - then having  
some in logback.xml and some in another place.

Also, we use the values in the MDC in frameworks besides logging. For  
example, we use the MDC values within the configuration file for  
Apache Commons Configuration's DefaultConfigurationBuilder class. If  
the value isn't set until a filter is called then it might not be set  
when it is needed for these other uses.

Ralph

On Aug 18, 2009, at 9:25 AM, haukex wrote:

>
> Hi Ralph,
>
> Thanks for the information, I was also thinking about writing some  
> custom
> code to insert the value in the MDC myself, but I was hoping this  
> might be
> supported out-of-the-box :) Since the value really is application- 
> wide, it
> makes more sense to me as something to be configured in  
> logback.xml... I was
> thinking of writing a custom filter that does nothing but set this  
> value in
> the MDC, but that seems a little wasteful.
>
> Regards,
> -- Hauke D
>
>
> rgoers wrote:
>>
>> In my organization we use a mechanism very similar to that shown in
>> http://www.slf4j.org/extensions.html#event_logger
>> . SLF4J doesn't provide standard key names or methods for common
>> fields, but you can easily create a wrapper of the MDC to do this. We
>> have a class called RequestContext that does exactly that. All our
>> applications use that class to access the data in the MDC.
>>
>> Ralph
>>
>
> -- 
> View this message in context: http://www.nabble.com/SocketAppender-application-property-tp25009895p25028524.html
> Sent from the Logback User mailing list archive at Nabble.com.
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user



More information about the Logback-user mailing list