Hi Ron

I will try explain with an example. I have a web page with allot of web handlers. Each handler is a kind of a web service and should have its own log file.

http://url/Protocol/P1/Receiver.ashx       Logfile: Protocol_P1.log
http://url/Protocol/P1/Handler.ashx        Logfile: Protocol_P1.log
http://url/Protocol/P2/Handler.ashx        Logfile: Protocol_P2.log


All handlers inherits a handlerbase that does something like this:

using (log4net.NDC.Push("Protocol_P1"))
{
   ProcessRequest(); // Abstract function overrided in each handler
}

- 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 <[EMAIL PROTECTED]> wrote:

Can I configure log4net to route messages from a specific NDC context
to a appender?

- Morten

Reply via email to