I'm attempting to implement logging in a c++ application using log4cplus. I'm able to successfully build/link (I added the log4cplus.lib to my additional libs and copied the log4cplus.dll to the build/outdir)
When I run my application, I get the following exception when it executes my Logger::getInstance call:
Unhandled exception at 0x75cad36f in LogTesterConsole.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0013ed8c..
I've tried placing the call outside my main() routine as well as inside and have the same results.
Any ideas?
Code:-
#include "stdafx.h"
#include <log4cplus/logger.h>
#include <log4cplus/loggingmacros.h>
#include <log4cplus/configurator.h>
using namespace log4cplus;
int _tmain(int argc, _TCHAR* argv[])
{
BasicConfigurator config;
config.configure();
Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("main"));
LOG4CPLUS_WARN(logger, LOG4CPLUS_TEXT("Hello, World!"));
return 0;
}