我正在使用 log4cplus 库,但无法正常工作。
我使用这段代码:
PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log.properties"));
Logger g_logger = Logger::getInstance(LOG4CPLUS_TEXT("mylogger"));
LOG4CPLUS_WARN(g_logger, LOG4CPLUS_TEXT("test test test"));
LOG4CPLUS_WARN
它因错误
而中断:Access violation reading location
这是我的调用堆栈:
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
的地方。LOG4CPLUS_WARN
我检查了这有什么问题,basic_ostringstream
似乎有些东西与编码或其他东西混淆了:
未终止的字符串(不可读的内存)和字符串末尾的一大堆奇怪字母?什么可能导致它?