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

Closes gh-15392
This commit is contained in:
Andy Wilkinson 2018-12-07 15:37:24 +00:00
parent 2cd3cff608
commit bbf0932f0f
9 changed files with 32 additions and 37 deletions

View File

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

View File

@ -22,16 +22,6 @@
<dependency>
<groupId>org.apache.solr</groupId>
<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>
<groupId>org.springframework.data</groupId>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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