logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Morten Andersen <mor...@vianett.no>
Subject Re: Question about NDC and appenders
Date Sat, 25 Mar 2006 10:24:59 GMT
I forgot to includethis in my last mail.

This is what I have today:
        <appender name="Protocol_P1" type="WebHandlerRollingFileAppender"/>

        <logger name="Protocol_P1_Receiver">
            <appender-ref ref="Protocol_P1"/>
        </logger>

        <logger name="Protocol_P1_Handler">
            <appender-ref ref="Protocol_P1"/>
        </logger>


Here I reference two loggers to the appender. What I need to do is to 
reference a NDC contexts (Protocol_P1_Receiver and Protocol_P1_Handler) 
to the Protocol_P1 appender.

- Morten

Ron Grabowski wrote:
> I don't understand the question. By specific NDC context do you mean
> you're using nested using() statements?
>
> using(ThreadContext.Stacks["NDC"].Push("first push"))
> {
>  using(ThreadContext.Stacks["NDC"].Push("second push"))
>  {
>   log.Info("This log message has two NDC entires");
>  }
>  log.Info("This log message has one NDC entry");
> }
>
> --- Morten Andersen <morten@vianett.no> wrote:
>
>   
>> Can I configure log4net to route messages from a specific NDC context
>> to 
>> a appender?
>>
>> - Morten
>>
>>     

Mime
View raw message