logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michel Marti <...@objectxp.com>
Subject log4cxx crashing when used in 'atexit' function.
Date Fri, 29 Aug 2008 19:46:54 GMT
Hello,

I noticed that log4cxx (SVN r677817) crashes (Segmentation Fault)
when trying to log from an exit-handler. The code below reproduces 
the crash:

#include <stdlib.h>
#include <log4cxx/logger.h>
#include <log4cxx/basicconfigurator.h>

static log4cxx::LoggerPtr log;

static void cleanup() {
         LOG4CXX_DEBUG(log, "Oops...");
}

int main(int argc, char **argv) {
         atexit(cleanup);
         log4cxx::BasicConfigurator::configure();
         log = log4cxx::Logger::getLogger("main");
         atexit(cleanup);
         return 0;
}

Is this a bug in log4cxx or should one expect this behavior? If its
expected: Is there a workaround for this problem (getting rid of
'atexit()' is not an option...).

Thanks,

- Michel


Mime
View raw message