rm5248 commented on issue #545:
URL:
https://github.com/apache/logging-log4cxx/issues/545#issuecomment-3494142351
I'll take a look at it in the coming days if Steven doesn't get to it first.
Unfortunately I think the proposed patch would break ABI compatibility, but we
should be able to create a new method that does your patch.
I think the reason it was returning a raw pointer was for speed.
> The crash occurs due to a race condition in Logger::getLoggerRepository()
where it returns a raw pointer (m_priv->repositoryRaw) that can become dangling
when the repository is destroyed/recreated by another thread during
multithreaded logger initialization.
How are you initializing your loggers? This makes it sound like you're
doing something like:
```
void thread_func(){
auto logger = log4cxx::LogManager::getLogger("MyApp");
LOG4CXX_INFO(logger, "foo");
}
```
Most of the time we recommend that you do loggers like the following,
declaring them to be static:
```
static auto logger = log4cxx::LogManager::getLogger("MyApp");
void thread_func(){
LOG4CXX_INFO(logger, "foo");
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]