You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2015/08/31 06:37:27 UTC

[06/12] logging-log4j2 git commit: Only change the level if it is different from the current level.

Only change the level if it is different from the current level.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/32956ad3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/32956ad3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/32956ad3

Branch: refs/heads/LOG4J2-952
Commit: 32956ad361808ffa412a5867bbb34859df3e94db
Parents: f14bc48
Author: ggregory <gg...@apache.org>
Authored: Fri Aug 28 12:54:41 2015 -0700
Committer: ggregory <gg...@apache.org>
Committed: Fri Aug 28 12:54:41 2015 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/logging/log4j/core/Logger.java       | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/32956ad3/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java
index 91ce841..667e9ac 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/Logger.java
@@ -104,6 +104,9 @@ public class Logger extends AbstractLogger {
      * @param level The Level to use on this Logger, may be null.
      */
     public synchronized void setLevel(final Level level) {
+        if (level == getLevel()) {
+            return;
+        }
         final Level actualLevel = level != null ? level : getParent().getLevel();
         config = new PrivateConfig(config, actualLevel);
     }