From d46591f141bf8edf7944544a26f419bbd8c50549 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 3 May 2017 13:25:55 +0100 Subject: [PATCH] Stop setting org.jboss.logging.provider when using Logback This fix for gh-1928 to address a problemw with Log4j was to set a system property that forces JBoss Logging to use SLF4J. This has the unwanted side-effect of crashing Glassfish. We no longer support Log4j so gh-1928 is no longer a concern. However, you can shoot yourself in the foot by having Logback and Log4j2 on the classpath in that particular order, but the latter has to be without its log4j-slf4j-impl module. At this point you don't get any warnings or error output at startup, but JBoss Logging uses Log4j2 while everything else uses SLF4J and Logback. As a result, any logging that's performed through JBoss Logging is silently lost. Given the problems caused by setting the system property, and the contrived nature of the arrangement that's necessary to cause a problem when the property isn't set, this commit updates LogbackLoggingSystem so that the system property is no longer set. Closes gh-8669 --- .../boot/logging/logback/LogbackLoggingSystem.java | 5 ----- .../boot/logging/logback/LogbackLoggingSystemTests.java | 6 ------ 2 files changed, 11 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java index c4a3f95660..8633366b8d 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/logback/LogbackLoggingSystem.java @@ -101,7 +101,6 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { } super.beforeInitialize(); loggerContext.getTurboFilterList().add(FILTER); - configureJBossLoggingToUseSlf4j(); } @Override @@ -208,10 +207,6 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { loadConfiguration(initializationContext, getSelfInitializationConfig(), null); } - private void configureJBossLoggingToUseSlf4j() { - System.setProperty("org.jboss.logging.provider", "slf4j"); - } - @Override public List getLoggerConfigurations() { List result = new ArrayList<>(); diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java index e1230eb98d..ea0470f611 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/logback/LogbackLoggingSystemTests.java @@ -253,12 +253,6 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { assertThat(output).contains("Hello debug world"); } - @Test - public void jbossLoggingIsConfiguredToUseSlf4j() { - this.loggingSystem.beforeInitialize(); - assertThat(System.getProperty("org.jboss.logging.provider")).isEqualTo("slf4j"); - } - @Test public void bridgeHandlerLifecycle() { assertThat(bridgeHandlerInstalled()).isFalse();