You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by mi...@apache.org on 2016/08/27 09:48:20 UTC

[03/50] [abbrv] logging-log4j2 git commit: [LOG4J2-1506] Unregister JMX ignores log4j2.disable.jmx property.

[LOG4J2-1506] Unregister JMX ignores log4j2.disable.jmx property.

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

Branch: refs/heads/LOG4J-1181
Commit: 53934c6d02586a576a0a8caa601e172e4d6fde60
Parents: b48cc0a
Author: Gary Gregory <gg...@apache.org>
Authored: Tue Aug 23 15:49:03 2016 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Tue Aug 23 15:49:03 2016 -0700

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


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/53934c6d/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
index 10f343a..034ce11 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
@@ -193,6 +193,10 @@ public final class Server {
      * Unregister all log4j MBeans from the platform MBean server.
      */
     public static void unregisterMBeans() {
+        if (isJmxDisabled()) {
+            LOGGER.debug("JMX disabled for log4j2. Not unregistering MBeans.");
+            return;
+        }
         final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
         unregisterMBeans(mbs);
     }