You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by deepak singh <de...@gmail.com> on 2009/06/23 13:32:05 UTC

NDC stack of parent thread visible to child thread??

Hi,
  Is there any way through which I can inherit the NDC stack to the child
thread?
  I have a parent thread running and create a child thread, I want the NDC
stack of the parentthread
  should also be applied to the child thread.
  Please let me know if we have anyway to do that?
Thnaks
Deepak

Re: NDC stack of parent thread visible to child thread??

Posted by "Jacob L. Anawalt" <ja...@geckosoftware.com>.
On 2009-06-23 23:00, Assaf Lavie wrote:
> 1. I find it very useful to implement a simple stack class that uses RAII to
> manage the NDC stack. In fact, I find it odd that log4cxx doesn't come with
> one built-in..2. 

I just use the NDC class and "push" via the constructor. It "pops" when the 
object is deconstructed [0]. This fits my expectations of RAII[1].

[0] http://wiki.apache.org/logging-log4cxx/NestedDiagnosticContexts
[1] http://www.parashift.com/c++-faq-lite/big-picture.html#faq-6.18

-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026

Re: NDC stack of parent thread visible to child thread??

Posted by Assaf Lavie <as...@gmail.com>.
1. I find it very useful to implement a simple stack class that uses RAII to
manage the NDC stack. In fact, I find it odd that log4cxx doesn't come with
one built-in..2. Using a stack such as this it's really not a problem to
pass a copy to another thread.

On Tue, Jun 23, 2009 at 1:32 PM, deepak singh <de...@gmail.com> wrote:

> Hi,
>   Is there any way through which I can inherit the NDC stack to the child
> thread?
>   I have a parent thread running and create a child thread, I want the NDC
> stack of the parentthread
>   should also be applied to the child thread.
>   Please let me know if we have anyway to do that?
> Thnaks
> Deepak
>