[logback-user] StatusListenerAction does not set context to ContextAware StatusListener

Tom Liu Tom.SH.Liu at MorganStanley.com
Tue Dec 8 12:29:01 CET 2009


Hi Ceki,

I mean the context of StatusListener, which is ContextAware, is not
set by the StatusListenerAction.

In StatusListenerAction:
statusListener = (StatusListener) OptionHelper.instantiateByClassName(
          className, StatusListener.class, context);
ec.getContext().getStatusManager().add(statusListener);
ec.pushObject(statusListener)

It does not set context to the StatusListener. But I expect it would
be similar to AppenderAction, which sets context to the appender.
appender = (Appender) OptionHelper.instantiateByClassName(className,
          ch.qos.logback.core.Appender.class, context);
appender.setContext(context);

Cheers,
Tom

On Tue, Dec 8, 2009 at 6:48 PM, Ceki Gulcu <ceki at qos.ch> wrote:
>
> Hello Tom,
>
> Whenever an action is placed in the rule store by a configurator, the
> context is set. See also SimpleRuleStore.addRule() method.
>
> So the context of StatusListenerAction is set at the time where it is
> actually invoked. Are you observing a different behavior?
>
> Cheers,
>
> --
> Ceki
>
> Tom Liu wrote:
>>
>> Hi,
>>
>> In logback 0.9.17/0.9.18, StatusListenerAction does not set context to
>> ContextAware StatusListener.
>> Is it by design?
>>
>> Thanks,
>> Tom
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>


More information about the Logback-user mailing list