Sam,

Thanks for the good repro case, nice to see someone using the tests!
I created an issue to track this:
http://issues.apache.org/jira/browse/LOG4NET-21
I have fixed this in CVS and will look at what we can do about updating
the release.

Many Thanks,
Nicko

> -----Original Message-----
> From: Sam Smoot [mailto:[EMAIL PROTECTED] 
> Sent: 02 April 2005 23:37
> To: Log4NET User
> Subject: Re: Missing LoggingEvents in RemotingAppender
> 
> Thanks for the reply and the great library! I was able to 
> duplicate the problem easily enough. I added this test to the
> RemotingAppenderTest:
> 
> [Test] public void TestNestedNDC() {
>                       // Setup the remoting appender
>                       ConfigureRootAppender(FixFlags.Partial);
> 
>                       RemoteLoggingSinkImpl.Instance.Events = null;
> 
>                       testService t = new testService();
>                       t.test();
> 
>                       // Wait for the remoted object to be delivered
>                       System.Threading.Thread.Sleep(1000);
> 
>                       LoggingEvent[] events = 
> RemoteLoggingSinkImpl.Instance.Events;
>                       Assertion.AssertEquals("Expect to 
> receive 1 remoted event", 1, events.Length);
>               }
> 
> Ignore the Assertion, that's just copy & paste I didn't put 
> the effort in to make the test pretty :-). You'll want to 
> modify the RemoteLoggingSinkImpl to add a Trace like so:
> 
> public void LogEvents(LoggingEvent[] events)
>                       {
>                               Events = events;
>                               foreach(LoggingEvent e in events) {
>                                       
> Trace.WriteLine(String.Format("Logger: {0}, Message: {1}", 
> e.LoggerName, e.RenderedMessage));
>                               }
>                       }
> 
> It's the Trace's you'll be watching out for. Here's the dummy 
> classes I made for the test:
> 
> namespace company.project {
>       public class feature {
>               static ILog log =
> LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMe
> thod().DeclaringType);
> 
>               public void test() {
>                       using(NDC.Push("test")) {
>                               log.Info("feature");
>                               dal d = new dal();
>                               d.test();
>                               log.Info("return");
>                       }
>               }
>       }
> }
> 
> namespace company.project.data {
>       public class dal {
>               static ILog log =
> LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMe
> thod().DeclaringType);
> 
>               public void test() {
>                       using(NDC.Push("test")) {
>                               log.Info("return");
>                       }
>               }
>       }
> }
> 
> namespace company.project.userInterfaces {
>       public class testService {
>               static ILog log =
> LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMe
> thod().DeclaringType);
> 
>               public void test() {
>                       log.Info("begin test.");
>                       feature f = new feature();
>                       f.test();
>                       log.Info("end test.");
>               }
>       }
> }
> 
> What you won't see is the log.Info("end test.") above in the Traces.
> You would in Beta8, but they're lost in Beta9. Atleast for 
> the RemotingAppender. They appeared just fine in the 
> RollingLogFileAppender. Now I'm not sure if the "dal" class 
> is even necessary. I suspect it isn't and the problem is any 
> NDC used in a class instantiated by another class in a 
> parallel namespace/loggerName that doesn't use NDC. Or 
> something like that. I was just duplicating the structure of 
> our production project we ran into this problem with with the 
> above code.
> 
> So hopefully this will let you reproduce the problem in a few seconds.
> Worked for me anyways. Thanks again for your hard work!
> 
> On Apr 2, 2005 1:53 PM, Nicko Cadell <[EMAIL PROTECTED]> wrote:
> > Sam,
> > 
> > There were some changes to the RemotingAppender to resolve an issue 
> > with call context data. There should be no problem with 
> using the NDC 
> > in conjunction with the RemotingAppender.
> > 
> > If there is an issue we would like to reproduce it so that 
> it can be 
> > fixed.
> > 
> > Do you have a simple reproduction case you can send me? If not how 
> > about the config file and details of the loggers and NDC data set, 
> > also the output you were seeing and the output you expected.
> > 
> > Many thanks,
> > Nicko
> > 
> > > -----Original Message-----
> > > From: Sam Smoot [mailto:[EMAIL PROTECTED]
> > > Sent: 30 March 2005 17:07
> > > To: [email protected]
> > > Subject: Re: Missing LoggingEvents in RemotingAppender
> > >
> > > Nevermind, I figured it out!
> > >
> > > In the sub-loggers I was using NDC all over the place, but not in 
> > > the root logger (ClassC). On a 
> > > wild-stab-in-the-dark-I've-been-working-on-this-for-8-hours-an
> > > d-am-out-of-ideas-hunch
> > > I removed all the NDC's and it started working again.
> > >
> > > I could have very well been using NDC's incorrectly in 
> Beta8, but it 
> > > did work, so I'd consider this a breaking change.
> > > Maybe it should go under consideration to have the 
> release notes for 
> > > Beta9 updated to reflect that so no one else wastes hours 
> with the 
> > > same problem. :-)
> > >
> > > Thanks, -Sam
> > >
> >
> 

Reply via email to