gabime / spdlog

Fast C++ logging library.
Other
24.39k stars 4.55k forks source link

getting exception: spdlog::spdlog_ex #3165

Closed soykot2910 closed 2 months ago

soykot2910 commented 2 months ago

Error Details: Function: throw_spdlog_ex(std::string msg) File: common-inl.h Line: 69 Exception Thrown: spdlog::spdlog_ex at memory location 0x00000028280FE7A8 Triggered during: Moving a message string (std::move(msg)) in SPDLOG_THROW.

Environment: Windows 11 Microsoft Visual Studio Professional 2022 (64-bit) Version 17.9.7

tt4g commented 2 months ago

I don't understand the cause of throw spdlog::spdlog_ex(). Please provide the error message as it is printed to STDERR by the error handler: https://github.com/gabime/spdlog/wiki/Error-handling

soykot2910 commented 2 months ago
Screenshot 2024-09-02 at 7 42 51 PM
tt4g commented 2 months ago

If you are using Visual Studio, the code in your project that caused the error can be found in the backtrace. Can you provide that?

soykot2910 commented 2 months ago
Screenshot 2024-09-02 at 8 52 02 PM
tt4g commented 2 months ago

It seems to be caused by trying to register a logger with the same name.

https://github.com/gabime/spdlog/blob/a3a0c9d66386962fcaf0178fcae03ac77c1e0257/include/spdlog/details/registry-inl.h#L248-L252

soykot2910 commented 2 months ago

But this same code works in my different laptop.

tt4g commented 2 months ago

If the problem does not occur on different machines, then it is probably a problem with the machine's environment.

soykot2910 commented 2 months ago

There is a version difference. I am getting an error with the updated version(1.14.1), but it works fine with the older version on my other machine.

tt4g commented 2 months ago

If the versions are different, it is not surprising that the libraries behave differently. The developer should make the changes that accompany the library version upgrade.

And spdlog began checking for duplicate logger names in version 0.9.0 (2f8e22d828bc48c41aaf2d5836b3dc9088a27284), which was released more than 8 years ago.

soykot2910 commented 2 months ago

It seems like this issue is related to the new version of Visual Studio.

tt4g commented 2 months ago

Recently MSVC made a destructive change to std::mutex (#3145, windows - First std::mutex::lock() crashes in application built with latest Visual Studio 2022 - Stack Overflow). However, your problem does not appear to be related to std::mutex.

You should report it to Microsoft.