You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
JMX support is enabled by default [...] To disable JMX completely, and prevent these MBeans from being created, specify system property log4j2.disableJmx to true when you start the Java VM.
JUnit 5 - Disable Log4J JMX beans creation in tests
Spring Boot - Do not create log4j2 JMX beans if spring.jmx.enabled=false
Log4j - Enabling JMX
logging-log4j2/log4j-core/src/main/java/org/apache/logging/log4j/core/jmx/Server.java
Lines 129 to 131 in 7b5d23e
For almost all tests the creation of the log4j2 JMX beans is unnecessary.
Spring Boot has disabled their JMX beans creation by default.
@SpringBootTest
will create log4j2 JMX beans if one uses log4j2 as its logging backend:Ideally, the creation of the log4j JMX beans would be opt-in but I guess for backward compatibility reasons the default cannot be changed.
It is easy to forget to set the
log4j2.disableJmx
system property—I would wager most people are not even aware of it.I suggest adding a programmatic way of enabling/disabling the log4j2 JMX bean creation.
Spring Boot could auto-configure it depending on
spring.jmx.enabled
.JUnit5 could disable it by default.
Explicitly setting
log4j2.disableJmx
would override the programmatic enabling/disabling.The text was updated successfully, but these errors were encountered: