You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by tinhuty he <ti...@hotmail.com> on 2006/06/01 23:04:13 UTC

NDC and MDC fields logged as (null)

I am using the 1.2.10. The NDC and MDC fields are logged in file as (null) 
if they are no value. Are they supposed to just log empty string if there 
are no values?

Thanks.

___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Re: NDC and MDC fields logged as (null)

Posted by Ron Grabowski <ro...@yahoo.com>.
Hmmm, I'm getting confused. Assuming we are dealing with this snippet
of code:

 using(ThreadContext.Stacks["NDC"].Push("Hello"))
 {
  log.Info("World");
 }

and a layout pattern of "%message %ndc" you should see this output:

 World Hello

--- Sean Carlin <se...@gmail.com> wrote:

> I'm running .NET 2.0 and I don't have a value for it, either.
> 
> Regards,
> Sean
> 
> On 6/21/06, Ron Grabowski <ro...@yahoo.com> wrote:
> >
> > The NDC is implemented with a ThreadContextStack which internally
> uses
> > a Stack to store values. If you don't push anything onto the NDC,
> the
> > Stack remains empty with a Count of zero.
> >
> > The NDC has a value when log messages are written inside of its
> scope:
> >
> > using(ThreadContext.Stacks["NDC"].Push("Hello"))
> > {
> >   log.Info("World");
> > }
> >
> > --- Ken Chu <ke...@yahoo.com> wrote:
> >
> > > Hmm, you mean the NDC doesn't always have a value?  Then when is
> the
> > > NDC not
> > > empty?  I had assumed it always had a value of some sort, like a
> > > thread id.
> > >
> > > -Ken
> >
> 

Re: NDC and MDC fields logged as (null)

Posted by Sean Carlin <se...@gmail.com>.
I'm running .NET 2.0 and I don't have a value for it, either.

Regards,
Sean

On 6/21/06, Ron Grabowski <ro...@yahoo.com> wrote:
>
> The NDC is implemented with a ThreadContextStack which internally uses
> a Stack to store values. If you don't push anything onto the NDC, the
> Stack remains empty with a Count of zero.
>
> The NDC has a value when log messages are written inside of its scope:
>
> using(ThreadContext.Stacks["NDC"].Push("Hello"))
> {
>   log.Info("World");
> }
>
> --- Ken Chu <ke...@yahoo.com> wrote:
>
> > Hmm, you mean the NDC doesn't always have a value?  Then when is the
> > NDC not
> > empty?  I had assumed it always had a value of some sort, like a
> > thread id.
> >
> > -Ken
>

Re: NDC and MDC fields logged as (null)

Posted by Ron Grabowski <ro...@yahoo.com>.
%property always contains log4net:HostName.

--- Ken Chu <ke...@yahoo.com> wrote:

> Hmm, you mean the NDC doesn't always have a value?  Then when is the
> NDC not
> empty?  I had assumed it always had a value of some sort, like a
> thread id.
> 
> -Ken

Re: NDC and MDC fields logged as (null)

Posted by Ron Grabowski <ro...@yahoo.com>.
The NDC is implemented with a ThreadContextStack which internally uses
a Stack to store values. If you don't push anything onto the NDC, the
Stack remains empty with a Count of zero.

The NDC has a value when log messages are written inside of its scope:

 using(ThreadContext.Stacks["NDC"].Push("Hello"))
 {
  log.Info("World");
 }

--- Ken Chu <ke...@yahoo.com> wrote:

> Hmm, you mean the NDC doesn't always have a value?  Then when is the
> NDC not
> empty?  I had assumed it always had a value of some sort, like a
> thread id.
> 
> -Ken

Re: NDC and MDC fields logged as (null)

Posted by Ken Chu <ke...@yahoo.com>.
Hmm, you mean the NDC doesn't always have a value?  Then when is the NDC not
empty?  I had assumed it always had a value of some sort, like a thread id.

-Ken

--- Ron Grabowski <ro...@yahoo.com> wrote:

> What should the value of the empty NDC be? null seems like an ok
> canidate doesn't it?
> 
> --- Ken Chu <ke...@yahoo.com> wrote:
> 
> > I was wondering why the value is null at all.  Shouldn't the NDC have
> > a value?
> > 
> > -Ken
> > 
> > --- Ron Grabowski <ro...@yahoo.com> wrote:
> > 
> > > The default string value for null items is "(null)". The default
> > string
> > > value for items that are not available is "NOT AVAILABLE". These
> > can be
> > > changed by setting the log4net.NullText and
> > log4net.NotAvailableText
> > > appSettings keys.
> > > 
> > > --- Ken Chu <ke...@yahoo.com> wrote:
> > > 
> > > > I'm seeing the same problem with the same version running on .Net
> > > > 2.0.  Anyone
> > > > else seeing this problem?  Is this a known bug?
> > > > 
> > > > -Ken
> > > > 
> > > > --- tinhuty he <ti...@hotmail.com> wrote:
> > > > 
> > > > > I am using the 1.2.10. The NDC and MDC fields are logged in
> > file as
> > > > (null) 
> > > > > if they are no value. Are they supposed to just log empty
> > string if
> > > > there 
> > > > > are no values?
> > > > > 
> > > > > Thanks.
> > > > > 
> > > > > ___________________________________________________________
> > > > > Sent by ePrompter, the premier email notification software.
> > > > > Free download at http://www.ePrompter.com.
> > > > > 
> > > > >
> > _________________________________________________________________
> > > > > Express yourself instantly with MSN Messenger! Download today -
> > > > it's FREE! 
> > > > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> > > > > 
> > > > > 
> > > > 
> > > > 
> > > 
> > > 
> > 
> > 
> 
> 


Re: NDC and MDC fields logged as (null)

Posted by Ron Grabowski <ro...@yahoo.com>.
What should the value of the empty NDC be? null seems like an ok
canidate doesn't it?

--- Ken Chu <ke...@yahoo.com> wrote:

> I was wondering why the value is null at all.  Shouldn't the NDC have
> a value?
> 
> -Ken
> 
> --- Ron Grabowski <ro...@yahoo.com> wrote:
> 
> > The default string value for null items is "(null)". The default
> string
> > value for items that are not available is "NOT AVAILABLE". These
> can be
> > changed by setting the log4net.NullText and
> log4net.NotAvailableText
> > appSettings keys.
> > 
> > --- Ken Chu <ke...@yahoo.com> wrote:
> > 
> > > I'm seeing the same problem with the same version running on .Net
> > > 2.0.  Anyone
> > > else seeing this problem?  Is this a known bug?
> > > 
> > > -Ken
> > > 
> > > --- tinhuty he <ti...@hotmail.com> wrote:
> > > 
> > > > I am using the 1.2.10. The NDC and MDC fields are logged in
> file as
> > > (null) 
> > > > if they are no value. Are they supposed to just log empty
> string if
> > > there 
> > > > are no values?
> > > > 
> > > > Thanks.
> > > > 
> > > > ___________________________________________________________
> > > > Sent by ePrompter, the premier email notification software.
> > > > Free download at http://www.ePrompter.com.
> > > > 
> > > >
> _________________________________________________________________
> > > > Express yourself instantly with MSN Messenger! Download today -
> > > it's FREE! 
> > > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> > > > 
> > > > 
> > > 
> > > 
> > 
> > 
> 
> 


Re: NDC and MDC fields logged as (null)

Posted by Ken Chu <ke...@yahoo.com>.
I was wondering why the value is null at all.  Shouldn't the NDC have a value?

-Ken

--- Ron Grabowski <ro...@yahoo.com> wrote:

> The default string value for null items is "(null)". The default string
> value for items that are not available is "NOT AVAILABLE". These can be
> changed by setting the log4net.NullText and log4net.NotAvailableText
> appSettings keys.
> 
> --- Ken Chu <ke...@yahoo.com> wrote:
> 
> > I'm seeing the same problem with the same version running on .Net
> > 2.0.  Anyone
> > else seeing this problem?  Is this a known bug?
> > 
> > -Ken
> > 
> > --- tinhuty he <ti...@hotmail.com> wrote:
> > 
> > > I am using the 1.2.10. The NDC and MDC fields are logged in file as
> > (null) 
> > > if they are no value. Are they supposed to just log empty string if
> > there 
> > > are no values?
> > > 
> > > Thanks.
> > > 
> > > ___________________________________________________________
> > > Sent by ePrompter, the premier email notification software.
> > > Free download at http://www.ePrompter.com.
> > > 
> > > _________________________________________________________________
> > > Express yourself instantly with MSN Messenger! Download today -
> > it's FREE! 
> > > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> > > 
> > > 
> > 
> > 
> 
> 


Re: NDC and MDC fields logged as (null)

Posted by Ron Grabowski <ro...@yahoo.com>.
The default string value for null items is "(null)". The default string
value for items that are not available is "NOT AVAILABLE". These can be
changed by setting the log4net.NullText and log4net.NotAvailableText
appSettings keys.

--- Ken Chu <ke...@yahoo.com> wrote:

> I'm seeing the same problem with the same version running on .Net
> 2.0.  Anyone
> else seeing this problem?  Is this a known bug?
> 
> -Ken
> 
> --- tinhuty he <ti...@hotmail.com> wrote:
> 
> > I am using the 1.2.10. The NDC and MDC fields are logged in file as
> (null) 
> > if they are no value. Are they supposed to just log empty string if
> there 
> > are no values?
> > 
> > Thanks.
> > 
> > ___________________________________________________________
> > Sent by ePrompter, the premier email notification software.
> > Free download at http://www.ePrompter.com.
> > 
> > _________________________________________________________________
> > Express yourself instantly with MSN Messenger! Download today -
> it's FREE! 
> > http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> > 
> > 
> 
> 


Re: NDC and MDC fields logged as (null)

Posted by Ken Chu <ke...@yahoo.com>.
I'm seeing the same problem with the same version running on .Net 2.0.  Anyone
else seeing this problem?  Is this a known bug?

-Ken

--- tinhuty he <ti...@hotmail.com> wrote:

> I am using the 1.2.10. The NDC and MDC fields are logged in file as (null) 
> if they are no value. Are they supposed to just log empty string if there 
> are no values?
> 
> Thanks.
> 
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today - it's FREE! 
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
> 
>