This is an automated email from the ASF dual-hosted git repository.
swebb2066 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git
The following commit(s) were added to refs/heads/master by this push:
new 93ed2792 The Repository state is now the Configurator's responsibility
(#532)
93ed2792 is described below
commit 93ed2792c89abab54ca97a4e5848568e70e05df7
Author: Stephen Webb <[email protected]>
AuthorDate: Tue Sep 2 12:18:31 2025 +1000
The Repository state is now the Configurator's responsibility (#532)
---
src/main/cpp/hierarchy.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/main/cpp/hierarchy.cpp b/src/main/cpp/hierarchy.cpp
index bbd8907a..b081a7d9 100644
--- a/src/main/cpp/hierarchy.cpp
+++ b/src/main/cpp/hierarchy.cpp
@@ -64,6 +64,8 @@ struct Hierarchy::HierarchyPrivate
std::vector<AppenderPtr> allAppenders;
mutable std::mutex listenerMutex;
+
+ const char* alreadyTriedMethod{ NULL };
};
IMPLEMENT_LOG4CXX_OBJECT(Hierarchy)
@@ -302,10 +304,10 @@ bool Hierarchy::isDisabled(int level) const
void Hierarchy::ensureIsConfigured(std::function<void()> configurator)
{
std::lock_guard<std::mutex> lock(m_priv->configuredMutex);
- if (!m_priv->configured)
+ if (!m_priv->configured && m_priv->alreadyTriedMethod !=
configurator.target_type().name())
{
configurator();
- m_priv->configured = true;
+ m_priv->alreadyTriedMethod = configurator.target_type().name();
}
}
@@ -343,6 +345,7 @@ void Hierarchy::shutdown()
void Hierarchy::shutdownInternal()
{
m_priv->configured = false;
+ m_priv->alreadyTriedMethod = NULL;
// begin by closing nested appenders
if (m_priv->root)