logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Westman <peter.west...@visualact.se>
Subject Cannot figure out how to clean correctly
Date Tue, 25 Oct 2016 11:51:13 GMT
Hi,

First off, let me say that we've been using log4cxx for some years now 
with great success. Its a wonderful library that really helps with 
debugging and supporting code. Ive been using the log4cxx 0.10.0, but 
upgraded to the svn trunk (r1755031) last week after having issues with 
SocketHubAppenders. Now Im getting problems with my valgrind tests.

I get tons of valgrind errors (112 to be exact), either starting at 
log4cxx::Logger::getLogger() or 
log4cxx::xml::DOMConfigurator::configure(). I feel like I'm missing some 
cleanup function, but log4cxx::xml::DOMConfigurator::configure() and 
log4cxx::xml::DOMConfigurator::resetConfiguration() are the only ones I 
can find and none help. I'm sure I've missed something, but can't seem 
to find out what. Please help me if anyone can see my error.

Here's a minimal example:

C++ code:

#include <log4cxx/xml/domconfigurator.h>
#include <log4cxx/logger.h>
#include <log4cxx/logmanager.h>
#include <iostream>

using namespace log4cxx;
using namespace std;

int main() {
log4cxx::xml::DOMConfigurator::configure("logging.xml");

     LoggerPtr logger = Logger::getLogger("a.b");
     LOG4CXX_INFO(logger, "asdf");
     LOG4CXX_FATAL(logger, "asdf");
     cout << "asdf" << endl;

     log4cxx::LogManager::shutdown();
     log4cxx::LogManager::resetConfiguration();

     return 0;
}


logging.xml contents:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
         debug="false" threshold="trace">
     <appender name="FileOut" class="org.apache.log4j.FileAppender">
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%d{ISO8601} %p %F:%L 
%c - %m%n" />
         </layout>
         <param name="File" value="out.log" />
         <param name="Append" value="true" />
         <param name="Threshold" value="trace" />
     </appender>

     <root>
         <appender-ref ref="FileOut" />
         <level value="debug" />
     </root>
</log4j:configuration>


Built using:
#uname -r
3.12-0.bpo.1-amd64

#g++ --version
g++ (Debian 4.4.5-8) 4.4.5
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Thank you in advance
Peter

Mime
View raw message