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 68545939ec..9b77396ceb 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 @@ -84,6 +84,7 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { public void beforeInitialize() { super.beforeInitialize(); getLogger(null).getLoggerContext().getTurboFilterList().add(FILTER); + configureJBossLoggingToUseSlf4j(); } @Override @@ -120,6 +121,10 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem { } } + private void configureJBossLoggingToUseSlf4j() { + System.setProperty("org.jboss.logging.provider", "slf4j"); + } + @Override public void setLogLevel(String loggerName, LogLevel level) { getLogger(loggerName).setLevel(LEVELS.get(level)); 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 e0eb506388..d05daaf073 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 @@ -34,6 +34,7 @@ import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.LoggerContext; import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertThat; @@ -44,6 +45,7 @@ import static org.junit.Assert.assertTrue; * * @author Dave Syer * @author Phillip Webb + * @author Andy Wilkinson */ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { @@ -134,4 +136,10 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests { assertTrue("Wrong output:\n" + output, output.contains("Hello world")); } + @Test + public void jbossLoggingIsConfiguredToUseSlf4j() { + this.loggingSystem.beforeInitialize(); + assertEquals("slf4j", System.getProperty("org.jboss.logging.provider")); + } + }