Skip to content

Commit

Permalink
Reduce the frequency of unit test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
stephen-webb committed Jul 19, 2024
1 parent 01f29a5 commit 62d4cb1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/cpp/loggingevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ const LogString& LoggingEvent::getCurrentThreadUserName()
#if LOG4CXX_HAS_THREAD_LOCAL
thread_local LogString thread_name;
#else
static WideLife<LogString> thread_name = LOG4CXX_STR("(noname)");
static LogString thread_name = LOG4CXX_STR("(noname)");
#endif
if( !thread_name.empty() ){
return thread_name;
Expand Down
9 changes: 9 additions & 0 deletions src/test/cpp/asyncappendertestcase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

#include "logunit.h"

#define LOG4CXX_TEST 1
#include <log4cxx/private/log4cxx_private.h>

#include <log4cxx/logger.h>
#include <log4cxx/logmanager.h>
#include <log4cxx/simplelayout.h>
Expand Down Expand Up @@ -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
}
});
}
Expand Down

0 comments on commit 62d4cb1

Please sign in to comment.