Polish "Avoid removing application-managed JUL bridge handler"

See gh-50779
This commit is contained in:
Stéphane Nicoll
2026-07-14 18:17:03 +02:00
parent fe5164521d
commit a2af5acbe2
@@ -407,6 +407,16 @@ class Log4J2LoggingSystemTests extends AbstractLoggingSystemTests {
assertThat(logger.getLevel()).isEqualTo(Level.FINE);
}
@Test
void cleanUpCleansBridgeHandlerInstalledByTheLoggingSystem() {
this.loggingSystem.beforeInitialize();
java.util.logging.Logger rootLogger = java.util.logging.Logger.getLogger("");
assertThat(rootLogger.getHandlers()).hasAtLeastOneElementOfType(Log4jBridgeHandler.class);
this.loggingSystem.cleanUp();
java.util.logging.Logger rootLoggerAfterCleanUp = java.util.logging.Logger.getLogger("");
assertThat(rootLoggerAfterCleanUp.getHandlers()).doesNotHaveAnyElementsOfTypes(Log4jBridgeHandler.class);
}
@Test
void cleanUpLeavesBridgeHandlerInstalledByTheApplicationInPlace() {
java.util.logging.Logger rootLogger = java.util.logging.Logger.getLogger("");