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 <An...@gmx.de> on 2005/07/21 22:29:28 UTC

Re: 0.9.8 - NDC

Hi Allen,

In Java, only push/pop can be used because objects are not automatically
destroyed at the end of the scope. For log4cxx, the
constructor/desctructor approach was probably added for convenience (to
be completely log4j compatible the constructor and destructor should
not even be public ;-) )

Looking into ndc.h, the push method is overloaded like

#if LOG4CXX_HAS_WCHAR_T
                 static void push(const std::wstring& message);
#endif
                 static void push(const std::string& message);

and I think this was simply missed for the constructor. Since
the constructor only calls push(), you can try if the attached
patch solves your issue.

Best Regards,

	Andreas

Conway Allen wrote:
> With the 0.9.7 i've been writing NDC ndc(mystring) where mystring is 
> some std::string or a const char*. I find that with the 0.9.8 I can't do 
> that - the compiler tells me that the only constructor I can use is a 
> copy constructor or one that takes a const LogString& which seems to be 
> a basic_string<wchar_t> or something like that. It is possible, however 
> to invoke NDC::push(mystring) but then you lose the advantage having the 
> destructor popping what was pushed. Is this how things are meant to be?

-- 
Andreas Fester
mailto:Andreas.Fester@gmx.de
WWW: http://littletux.homelinux.org
ICQ: 326674288