You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Jenica Mehta <je...@rediffmail.com> on 2008/01/30 07:00:45 UTC

getAllAppenders() function throws exception

Hi,Here is&nbsp;snippet of my code. This code throws exception while leaving the main function, something related to getAllAppenders() which it is unable to delete.
#include &lt;log4cxx/logger.h&gt;

#include &lt;log4cxx/fileappender.h&gt;


&nbsp;
using namespace log4cxx;

using namespace log4cxx::spi;

using namespace log4cxx::helpers;


&nbsp;
int _tmain(int argc, _TCHAR* argv[]){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 


&nbsp;
LoggerPtr logger = Logger::getLogger(_T("test"));

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AppenderPtr a1 = new FileAppender();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a1-&gt;setName(_T("testAppender1"));

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger-&gt;addAppender(a1);


&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AppenderList list = logger-&gt;getAllAppenders();

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AppenderPtr aHat = list.front();

}This works fine if in project settings -&gt; C/C++ -&gt; Code Generation -&gt; Runtime Library is set to Multi-threaded Debug DLL in Visual Studio. but if different&nbsp;runtime library is set, getAllAppenders() function throws exception of not able to delete the appenderlist. Any help on this will be appreciated. I am new member to this mailing list. Please ignore if I have put the mail wrongly.Thanks &amp; Regards,Jenica

Re: getAllAppenders() function throws exception

Posted by Curt Arnold <ca...@apache.org>.
Actually, I'm surprised you were able to build.  You may be getting  
bit by the issue reported in LOGCXX-219 (https://issues.apache.org/jira/browse/LOGCXX-219 
).  There is the potential for disaster when log4cxx and the client  
code both instantiate the same template, but have different settings.   
But, It is still never a healthy thing to mix and match C run time  
libraries within an application.  Rev 616702 should build.  If you  
find yourself getting a copy prior to that, try again using https  
instead of http.