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
This commit is contained in:
Andy Wilkinson 2017-05-03 13:25:55 +01:00
parent abdc23905f
commit d46591f141
2 changed files with 0 additions and 11 deletions

View File

@ -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<LoggerConfiguration> getLoggerConfigurations() {
List<LoggerConfiguration> result = new ArrayList<>();

View File

@ -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();