1.2.9, I think (not at the office right now).
It doesn't throw an exception, but it stopps logging.

________________________________

From: Ron Grabowski [mailto:[EMAIL PROTECTED]
Sent: Sun 2006-07-23 22:42
To: Log4NET User
Subject: Re: Log4net bug when using ThreadContext



This code:

 // Console Application
 ConsoleAppender consoleAppender = new ConsoleAppender();
 consoleAppender.Layout =
  new PatternLayout("%level %message %property");
 BasicConfigurator.Configure(consoleAppender);
 ILog log = LogManager.GetLogger(typeof(Class1));
 using (ThreadContext.Stacks["1"].Push(null))
 {
  log.Error("Should work");
 }

throws a NullReferenceException in log4net 1.2.9 beta
(log4net.Util.StackFrame.get_FullMessage()). It does not throw an
exception in 1.2.10.

What version of log4net are you using? Are you getting an exception
when the code fails?

--- Oren Eini <[EMAIL PROTECTED]> wrote:

> The following code is failing, even though it looks like it can work:
>
> 
>
> MemoryAppender appender = new MemoryAppender();
>
> ILog logger = LogManager.GetLogger("foo");
>
> 
>
> BasicConfigurator.Configure(appender);
>
> 
>
> using (log4net.ThreadContext.Stacks["1"].Push(null))
>
> {
>
>     logger.Error("Should work");
>
> }
>
> 
>
> Debug.Assert(appender.GetEvents().Length != 0);
>
>



<<winmail.dat>>

Reply via email to