[
https://issues.apache.org/jira/browse/LOG4J2-1506?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15530146#comment-15530146
]
Remko Popma edited comment on LOG4J2-1506 at 9/28/16 4:28 PM:
--------------------------------------------------------------
Applied 0003-JMX-Server-unregistering-won-t-ignore-log4j2.disable.patch to
master in commit 18c1f9f.
Please verify and close.
Thank you! The 2.7-rc1 vote is cancelled due to a compatibility breakage with
the Kafka appender, so this patch will make it into the 2.7 release.
was (Author: [email protected]):
Applied 0003-JMX-Server-unregistering-won-t-ignore-log4j2.disable.patch to
master in commit 18c1f9f.
Thank you!
Please verify and close.
> Unregister JMX ignores log4j2.disable.jmx property
> --------------------------------------------------
>
> Key: LOG4J2-1506
> URL: https://issues.apache.org/jira/browse/LOG4J2-1506
> Project: Log4j 2
> Issue Type: Bug
> Components: JMX
> Affects Versions: 2.6.2
> Environment: Stripped OpenJDK (without java.lang.management)
> Reporter: Johannes Schleger
> Assignee: Remko Popma
> Fix For: 2.7
>
> Attachments:
> 0001-JMX-Server-unregistering-won-t-ignore-log4j2.disable.patch,
> 0002-JMX-Server-unregistering-won-t-ignore-log4j2.disable.patch,
> 0003-JMX-Server-unregistering-won-t-ignore-log4j2.disable.patch
>
>
> If java.lang.management is due to security reasons (or anything else) not
> part of the JVM, we need so set the JVM Property -Dlog4j2.jmx.disable=true.
> The initialization of the JVM is fine, as the JMX Server class verifies if
> JMX is disabled. The Problem is as soon as log4j shuts down, it tries to
> unregister JMX and ends up with a NoClassDefFoundError, thus log4j exits
> abnormally.
> {code:title=Server.java|borderStyle=solid}
> public static void reregisterMBeansAfterReconfigure() {
> // avoid creating Platform MBean Server if JMX disabled
> if (isJmxDisabled()) {
> LOGGER.debug("JMX disabled for log4j2. Not registering MBeans.");
> return;
> }
> final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
> reregisterMBeansAfterReconfigure(mbs);
> }
> public static void unregisterLoggerContext(final String
> loggerContextName) {
> final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
> unregisterLoggerContext(loggerContextName, mbs);
> }
> {code}
> {code:java}
> 2016-08-09 18:54:06,512 pool-1-thread-1 ERROR Caught exception executing
> shutdown hook Shutdown callback for LoggerContext[name=4ee00c09]
> java.lang.NoClassDefFoundError: java/lang/management/ManagementFactory
> at
> org.apache.logging.log4j.core.jmx.Server.unregisterLoggerContext(Server.java:236)
> at
> org.apache.logging.log4j.core.LoggerContext.stop(LoggerContext.java:300)
> at
> org.apache.logging.log4j.core.LoggerContext$1.run(LoggerContext.java:265)
> at
> org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry$RegisteredCancellable.run(DefaultShutdownCallbackRegistry.java:102)
> at
> org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.run(DefaultShutdownCallbackRegistry.java:72)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.ClassNotFoundException:
> java.lang.management.ManagementFactory
> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> ... 6 more
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]