Exclude jcl-over-slf4j in favour of spring-jcl

Closes gh-15392
pull/15424/head
Andy Wilkinson 6 years ago
parent 2cd3cff608
commit bbf0932f0f

@ -1696,6 +1696,12 @@
<groupId>org.apache.solr</groupId> <groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId> <artifactId>solr-solrj</artifactId>
<version>${solr.version}</version> <version>${solr.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.solr</groupId> <groupId>org.apache.solr</groupId>

@ -22,16 +22,6 @@
<dependency> <dependency>
<groupId>org.apache.solr</groupId> <groupId>org.apache.solr</groupId>
<artifactId>solr-solrj</artifactId> <artifactId>solr-solrj</artifactId>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.data</groupId> <groupId>org.springframework.data</groupId>

@ -172,11 +172,6 @@
<artifactId>kotlin-runtime</artifactId> <artifactId>kotlin-runtime</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId> <artifactId>slf4j-api</artifactId>

@ -21,11 +21,6 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!-- Test --> <!-- Test -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>

@ -373,11 +373,6 @@
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId> <artifactId>spring-context-support</artifactId>

@ -26,15 +26,16 @@ import java.util.logging.Handler;
import java.util.logging.LogManager; import java.util.logging.LogManager;
import java.util.logging.Logger; import java.util.logging.Logger;
import ch.qos.logback.classic.LoggerContext;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.impl.SLF4JLogFactory;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.slf4j.bridge.SLF4JBridgeHandler; import org.slf4j.bridge.SLF4JBridgeHandler;
import org.slf4j.impl.StaticLoggerBinder;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.event.ApplicationFailedEvent; import org.springframework.boot.context.event.ApplicationFailedEvent;
@ -89,9 +90,11 @@ public class LoggingApplicationListenerTests {
private final LoggingApplicationListener initializer = new LoggingApplicationListener(); private final LoggingApplicationListener initializer = new LoggingApplicationListener();
private final SLF4JLogFactory logFactory = new SLF4JLogFactory(); private final LoggerContext loggerContext = (LoggerContext) StaticLoggerBinder
.getSingleton().getLoggerFactory();
private final Log logger = this.logFactory.getInstance(getClass()); private final ch.qos.logback.classic.Logger logger = this.loggerContext
.getLogger(getClass());
private final SpringApplication springApplication = new SpringApplication(); private final SpringApplication springApplication = new SpringApplication();
@ -404,9 +407,9 @@ public class LoggingApplicationListenerTests {
this.initializer.initialize(this.context.getEnvironment(), this.initializer.initialize(this.context.getEnvironment(),
this.context.getClassLoader()); this.context.getClassLoader());
this.logger.debug("testatdebug"); this.logger.debug("testatdebug");
this.logger.fatal("testatfatal"); this.logger.error("testaterror");
assertThat(this.outputCapture.toString()).doesNotContain("testatdebug") assertThat(this.outputCapture.toString()).doesNotContain("testatdebug")
.doesNotContain("testatfatal"); .doesNotContain("testaterror");
} }
@Test @Test
@ -416,9 +419,9 @@ public class LoggingApplicationListenerTests {
this.initializer.initialize(this.context.getEnvironment(), this.initializer.initialize(this.context.getEnvironment(),
this.context.getClassLoader()); this.context.getClassLoader());
this.logger.debug("testatdebug"); this.logger.debug("testatdebug");
this.logger.fatal("testatfatal"); this.logger.error("testaterror");
assertThat(this.outputCapture.toString()).doesNotContain("testatdebug") assertThat(this.outputCapture.toString()).doesNotContain("testatdebug")
.doesNotContain("testatfatal"); .doesNotContain("testaterror");
} }
@Test @Test
@ -657,7 +660,7 @@ public class LoggingApplicationListenerTests {
} }
private void assertTraceEnabled(String name, boolean expected) { private void assertTraceEnabled(String name, boolean expected) {
assertThat(this.logFactory.getInstance(name).isTraceEnabled()) assertThat(this.loggerContext.getLogger(name).isTraceEnabled())
.isEqualTo(expected); .isEqualTo(expected);
} }

@ -31,8 +31,6 @@ import ch.qos.logback.core.ConsoleAppender;
import ch.qos.logback.core.CoreConstants; import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.rolling.RollingFileAppender; import ch.qos.logback.core.rolling.RollingFileAppender;
import ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy; import ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.impl.SLF4JLogFactory;
import org.hamcrest.Matcher; import org.hamcrest.Matcher;
import org.hamcrest.Matchers; import org.hamcrest.Matchers;
import org.junit.After; import org.junit.After;
@ -87,7 +85,7 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
private final LogbackLoggingSystem loggingSystem = new LogbackLoggingSystem( private final LogbackLoggingSystem loggingSystem = new LogbackLoggingSystem(
getClass().getClassLoader()); getClass().getClassLoader());
private Log logger; private Logger logger;
private LoggingInitializationContext initializationContext; private LoggingInitializationContext initializationContext;
@ -96,7 +94,8 @@ public class LogbackLoggingSystemTests extends AbstractLoggingSystemTests {
@Before @Before
public void setup() { public void setup() {
this.loggingSystem.cleanUp(); this.loggingSystem.cleanUp();
this.logger = new SLF4JLogFactory().getInstance(getClass().getName()); this.logger = ((LoggerContext) StaticLoggerBinder.getSingleton()
.getLoggerFactory()).getLogger(getClass());
this.environment = new MockEnvironment(); this.environment = new MockEnvironment();
this.initializationContext = new LoggingInitializationContext(this.environment); this.initializationContext = new LoggingInitializationContext(this.environment);
} }

@ -35,6 +35,12 @@
<artifactId>cassandra-unit-spring</artifactId> <artifactId>cassandra-unit-spring</artifactId>
<version>3.5.0.1</version> <version>3.5.0.1</version>
<scope>test</scope> <scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>

@ -34,6 +34,12 @@
<artifactId>docker-java</artifactId> <artifactId>docker-java</artifactId>
<version>3.0.14</version> <version>3.0.14</version>
<scope>test</scope> <scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

Loading…
Cancel
Save