elasticsearch
elasticsearch copied to clipboard
Make MockLogAppender threadsafe
Adding and removing appenders in Log4j is not threadsafe. Yet some tests rely on capturing logging by adding an in memory appender, MockLogAppender. This commit makes the mock logging threadsafe by creating a new, singular appender for mock logging that delegates, in a threadsafe way, to the existing appenders created. Confusingly MockLogAppender is no longer really an appender, but I'm leaving clarifying that for a followup so as to limit the scope of this PR.
closes #106425
Pinging @elastic/es-core-infra (Team:Core/Infra)
@ldematte @thecoop I believe I've addressed your comments.
(btw, CI test failure looks related but should be fixable)