Open wluter opened 10 months ago
I have a minimal project ready to demonstrate the problem. Some additional notes: 1) If you compile static with a vcpkg manifest file using no features it compiles, easylogging initializes, and it runs but will eventually crash if you log from multiple threads. 2) If you enable feature no-defaultfile it will not initialize 3) If you enable thread-safe it will not initialize 4) Because MFC application does not expose main() then INITIALIZE_EASYLOGGING must be put in the cpp of the CWinApp derived application class where InitInstance is called. Maybe this is the problem?
Further reading and debugging indicates this may be due to it being a static compilation. The actual HeapAlloc error occurs during creation of el::base::Storage.
To debug I replaced INITIALIZE_EASYLOGGINGPP AS FOLLOWS:
//INITIALIZE_EASYLOGGINGPP namespace el { namespace base { el::base::type::StoragePointer elStorage; } el::base::debug::CrashHandler elCrashHandler(ELPP_USE_DEF_CRASH_HANDLER); }
And put this at the begging of main:
el::base::DefaultLogBuilder* dlb = new el::base::DefaultLogBuilder(); el::LogBuilderPtr lpb(dlb); el::base::Storage * s = new el::base::Storage(lpb); //<<< FAILS HERE el::base::elStorage.reset(s); START_EASYLOGGINGPP(argc, argv);
And the trace shows it fails in Logger* RegisteredLoggers::get
I also have this issue. @wluter did you ever find a solution?
I also have this issue. @wluter did you ever find a solution?
I did not. I ran out of time trying so I moved on to use g3log instead. I have had tremendous success with it so I have abandoned easyloggingpp. NOTE: if you need multiple log files then g3log is more work - it has a single stream sink and you have to create your own sinks for multiple log files.
Thank you so much! I'll give g3log a try!
easyloggingpp from vcpkg seems to throw during INITIALIZE_EASYLOGGINGPP when used in a static build on Windows with thread-safe feature enabled. The error involves heap allocation.
It is a 64 bit MFC application on windows with static build and uses vcpkg for several components including easyloggingpp
Stack Trace: ntdll.dll!00007ffb4eabe414() Unknown ntdll.dll!00007ffb4eabb44d() Unknown