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 Andreas Fester <af...@apache.org> on 2005/12/22 14:59:49 UTC

Missing NDC constructor

Hi,

the attached patch adds a missing constructor which
takes a wstring& to the NDC class.

If there are not objections, I will commit it.

Thanks,

	Andreas


Re: Missing NDC constructor

Posted by Curt Arnold <ca...@apache.org>.
On Dec 22, 2005, at 7:59 AM, Andreas Fester wrote:

> Hi,
>
> the attached patch adds a missing constructor which
> takes a wstring& to the NDC class.
>
> If there are not objections, I will commit it.
>
> Thanks,
>
> 	Andreas
>

+1

I had to look at this one for a while.  new NDC() is prohibited in  
log4j.  In log4cxx, it wraps up a push and a pop into the NDC object  
lifecycle.  So these two fragments would do the same thing:

{
     log4cxx::NDC("some action");
     someAction();
}

{
    log4cxx::NDC::push("some action");
    someAction();
    log4cxx::NDC::pop();
}

Except the first will still pop the value from the NDC if there is an  
exception.

I thought I had built log4cxx where LogString was neither  
std::wstring or std::string.  But apparently I hadn't, since that  
should have caught the mismatch.