diff --git a/src/main/cpp/loggingevent.cpp b/src/main/cpp/loggingevent.cpp index 690102025..a0f25c5e6 100644 --- a/src/main/cpp/loggingevent.cpp +++ b/src/main/cpp/loggingevent.cpp @@ -383,7 +383,7 @@ const LogString& LoggingEvent::getCurrentThreadUserName() #if LOG4CXX_HAS_THREAD_LOCAL thread_local LogString thread_name; #else - static WideLife thread_name = LOG4CXX_STR("(noname)"); + static LogString thread_name = LOG4CXX_STR("(noname)"); #endif if( !thread_name.empty() ){ return thread_name; diff --git a/src/test/cpp/asyncappendertestcase.cpp b/src/test/cpp/asyncappendertestcase.cpp index 33b2f3717..6a960c57f 100644 --- a/src/test/cpp/asyncappendertestcase.cpp +++ b/src/test/cpp/asyncappendertestcase.cpp @@ -17,6 +17,9 @@ #include "logunit.h" +#define LOG4CXX_TEST 1 +#include + #include #include #include @@ -250,7 +253,13 @@ class AsyncAppenderTestCase : public AppenderSkeletonTestCase { for (size_t i = 0; i < LEN; i++) { +// As at 2024-7-19 the msys2 ucrt-x86_64 runtime terminates with error c0000374 during thread local data cleanup +// The call to debug() avoids the use of the thread_local data in MessageBuffer +#if LOG4CXX_HAS_THREAD_LOCAL && LOG4CXX_HAS_PTHREAD_SELF && !(defined(_WIN32) && defined(_LIBCPP_VERSION)) + root->debug("message" + std::to_string(i)); +#else LOG4CXX_DEBUG(root, "message" << i); +#endif } }); }