Good morning. I’m investigating new features of VS 2015 for future migrating of our application, and find out that the previous working code of lo4cxx is now broken. We have a common application level configuration file, where there is a section dedicated to log configuration. We read that section as a text and populate it via code like (sniplet…)
log4cxx::helpers::Properties basicProps; std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cvt; const std::wstring wName = cvt.from_bytes(name); //name, read from file const std::wstring wValue = cvt.from_bytes(value); //value, read from file basicProps.setProperty(wName, wValue); After setProperty call I get an heap corruption, imo, assertion (assert.png) The stack looks like (stack.txt). setProperty returns LogString, so if I write log4cxx::LogString& v = basicProps.setProperty(wName, wValue); the program successfully runs on this line, but still crashes, with the same exception at the end of the scope. To be able to compile, I made some changes to log4cxx.h , like from the link https://issues.apache.org/jira/secure/attachment/12596517/msvs2012.patch Compilers used: OS: windows server 2008 Compilation: 64 bit All compilers are run with support of C++11. Visual Studio 2014 (v140) - Crash Visual Studio 2013 (v120) - Crash Visual Studio 2012 (v110) - Ok, but that was expected, it is what we use now Intel Compiler 16 - Crash Intel Compiler 14 - Ok, again, it is what we are using now What can I do to overcome this issue. ? P.S: What I tried so far. 1) Implement my std::map with std::wstring and feed it into the PropertyConfigurator. Same story, cause inside it uses same setProperty method. 2) Save log4cxx configuration section into the separate file and read it via overload of configure log4cxx::PropertyConfigurator::configure(log4cxx::File("C:\\log4.txt")); Logger still not able to initialize, giving errors. Repeat, it’s enough to change a compiler (from one listed above) and all works perfectly. Thank you. Tigran martirosyan software engineer AIR Worldwide | 131 Dartmouth Street | Boston, MA 02116 Email: smo...@air-worldwide.com<mailto:smo...@air-worldwide.com> www.air-worldwide.com<http://www.air-worldwide.com/> Verisk Insurance Solutions ● ISO | AIR Worldwide | Xactware TOUCHSTONE(r)<http://www.air-worldwide.com/Software-Solutions/Touchstone/> Own the risk.<http://www.air-worldwide.com/Software-Solutions/Touchstone/> ><http://www.air-worldwide.com/Software-Solutions/Touchstone/>
appcrt140d.dll!000007fee3fdb86f() Unknown appcrt140d.dll!000007fee3fdeb55() Unknown Common.dll!operator delete(void * block) Line 21 C++ Common.dll!std::_Deallocate<std::_Container_proxy>(std::_Container_proxy * _Ptr, unsigned __int64 _Count) Line 137 C++ Common.dll!std::allocator<std::_Container_proxy>::deallocate(std::_Container_proxy * _Ptr, unsigned __int64 _Count) Line 643 C++ Common.dll!std::_Wrap_alloc<std::allocator<std::_Container_proxy> >::deallocate(std::_Container_proxy * _Ptr, unsigned __int64 _Count) Line 911 C++ Common.dll!std::_String_alloc<std::_String_base_types<wchar_t,std::allocator<wchar_t> > >::_Free_proxy() Line 629 C++ Common.dll!std::_String_alloc<std::_String_base_types<wchar_t,std::allocator<wchar_t> > >::~_String_alloc<std::_String_base_types<wchar_t,std::allocator<wchar_t> > >() Line 597 C++ Common.dll!std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >::~basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> >() Line 986 C++ > Common.dll!loggerSetup(const DriverParams & args) Line 60 C++ > //our code Common.dll!Arguments::ParseSwitches() Line 181 C++ //our code Common.dll!Arguments::Arguments(const std::basic_string<char,std::char_traits<char>,std::allocator<char> > & str) Line 74 C++ //our code