ppkarwasz commented on issue #2774:
URL: 
https://github.com/apache/logging-log4j2/issues/2774#issuecomment-2254414225

   The code seems to work as expected, the only problem I see is the severity 
of the status logger call, which should not be `ERROR` but `INFO` or `DEBUG`:
   
   
https://github.com/apache/logging-log4j2/blob/f0cb225f5b7932a9d8108f2291da571ccb1e2a13/log4j-core/src/main/java/org/apache/logging/log4j/core/LoggerContext.java#L641-L646
   
   
https://github.com/apache/logging-log4j2/blob/f0cb225f5b7932a9d8108f2291da571ccb1e2a13/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java#L133-L141
   
   Unless I am mistaken the `Server.reregisterMBeansAfterReconfigure()` can 
throw a linkage error at any moment:
   
   * a very eager JVM could throw the exception when the `Server` class is 
initialized (if it resolves all the references in its methods)
   * a less eager JVM could throw the exception when the 
`reregisterMBeansAfterReconfigure()` method is called,
   * only a very lazy JVM will evaluate the if statement on line 135.
   
   To solve this issue I would propose to test the value of `log4j2.disableJmx` 
configuration property in the `LoggerContext` class, before we even reference 
the `Server` class.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to