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 9cd4120a Set the level of a logger only if it changes (#270)
9cd4120a is described below
commit 9cd4120a00614169fc54cb1baf4e880752322554
Author: bieriol <[email protected]>
AuthorDate: Thu Oct 5 05:20:46 2023 +0200
Set the level of a logger only if it changes (#270)
---
src/main/cpp/logger.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/main/cpp/logger.cpp b/src/main/cpp/logger.cpp
index c328034a..06ddcf0c 100644
--- a/src/main/cpp/logger.cpp
+++ b/src/main/cpp/logger.cpp
@@ -538,10 +538,13 @@ void Logger::setParent(LoggerPtr parentLogger)
void Logger::setLevel(const LevelPtr level1)
{
- m_priv->level = level1;
- updateThreshold();
- if (auto rep = dynamic_cast<Hierarchy*>(getHierarchy()))
- rep->updateChildren(this);
+ if (m_priv->level != level1)
+ {
+ m_priv->level = level1;
+ updateThreshold();
+ if (auto rep = dynamic_cast<Hierarchy*>(getHierarchy()))
+ rep->updateChildren(this);
+ }
}
void Logger::updateThreshold()