logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Fester <Andreas.Fes...@gmx.de>
Subject Re: 0.9.8 - NDC
Date Thu, 21 Jul 2005 20:29:28 GMT
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

Mime
View raw message