I'm using log4cplus library and I can't get logging to work.
I use this code:
PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log.properties"));
Logger g_logger = Logger::getInstance(LOG4CPLUS_TEXT("mylogger"));
LOG4CPLUS_WARN(g_logger, LOG4CPLUS_TEXT("test test test"));
And it breaks at LOG4CPLUS_WARN
with error:
Access violation reading location
This is my Call Stack:
msvcp110d.dll!std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >::egptr() Line 236 C++
ProjectClientd.exe!std::basic_stringbuf<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::str() Line 103 C++
ProjectClientd.exe!std::basic_ostringstream<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::str() Line 553 C++
> ProjectClientd.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 55 C++
ProjectClientd.exe!__tmainCRTStartup() Line 528 C
ProjectClientd.exe!wWinMainCRTStartup() Line 377 C
where wWinMain ... line 55
is a place where LOG4CPLUS_WARN
is being called.
I have checked what's wrong with this basic_ostringstream
and it seems that something is messed up with encoding or something:
Non-terminated string (unreadable memory) and a whole bunch of strange letters at the end of my string? What may cause it?