[logback-user] Integrating OSGi (Felix), Logback and SLF4J

Sander de Groot s.degroot at jdi.nl
Mon Jul 12 16:49:40 CEST 2010


Ah i see. Maybe the SiftingAppender is even a better option!
But even with the SiftingAppender the problem is the same, like you said 
I need a way to differentiate between bundles.
I'd like to differentiate based on the bundle name (or symbolic name). 
I'd use the MDC discriminator but this is not an option since SLF4J is 
also shared between all bundles.

It's not a problem if I need to do one or a few calls within each bundle 
for the logging to work correctly.
The longer I think about it the more I think its easier to use multiple 
contexts.

How should I continue?

On 07/06/2010 09:52 AM, Ceki Gülcü wrote:
>
> Hi Sander,
>
> ContextSelector is one way of demultiplexing events per
> bundle. Another way is through SiftingAppender (or GSiftingAppender
> its equivalent in Groovy) which might be more convenient to use.
>
> Regardless of whether you use ContextSelector or
> SiftingAppender/GSiftingAppender, you first need a way to distinguish
> events generated by different bundles. Is there a way to differentiate
> logging events generated by different bundles?
>
> [1] http://logback.qos.ch/manual/appenders.html#SiftingAppender
>
> On 05/07/2010 11:59 AM, Sander de Groot wrote:
>> I'm trying to integrate Logback Classic in Apache Felix.
>> My goal is to have a bundle-based context system so each bundle has it's
>> own logging factory.
>> It's important that each bundle is able to supply it's own configuration
>> file.
>>
>> I've tried a few things and even wrote a simple ContextSelector but I
>> don't seem to get it right. Therefore I thought: before going in a time
>> consuming trial and error process let's ask the experts first.
>>
>> So, my question: how can I create new loggercontexts efficiently with
>> each a separate configuration?
>>
>> Regards,
>>
>> Sander
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user


More information about the Logback-user mailing list