INT-4376: Upgage to Log4J 2 (#2321)
* INT-4376: Upgage to Log4J 2 JIRA: https://jira.spring.io/browse/INT-4376 * Deprecate Log4J 1.x components in favor of newly added a `Log4j2LevelAdjuster` JUnit `@Rule` * Update all the logging configuration to Log4J 2 * Polishing after testing
This commit is contained in:
committed by
Gary Russell
parent
422f651113
commit
30450c48be
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2017 the original author or authors.
|
||||
* Copyright 2016-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,7 +25,6 @@ import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.log4j.Level;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Rule;
|
||||
@@ -37,7 +36,7 @@ import org.springframework.integration.leader.Context;
|
||||
import org.springframework.integration.leader.DefaultCandidate;
|
||||
import org.springframework.integration.leader.event.LeaderEventPublisher;
|
||||
import org.springframework.integration.support.leader.LockRegistryLeaderInitiator;
|
||||
import org.springframework.integration.test.rule.Log4jLevelAdjuster;
|
||||
import org.springframework.integration.test.rule.Log4j2LevelAdjuster;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
|
||||
@@ -54,8 +53,12 @@ public class JdbcLockRegistryLeaderInitiatorTests {
|
||||
public static EmbeddedDatabase dataSource;
|
||||
|
||||
@Rule
|
||||
public Log4jLevelAdjuster adjuster = new Log4jLevelAdjuster(Level.DEBUG, "org.springframework.integration",
|
||||
"org.springframework.integration.jdbc", "org.springframework.jdbc", "org.apache.derby");
|
||||
public Log4j2LevelAdjuster adjuster =
|
||||
Log4j2LevelAdjuster.trace()
|
||||
.categories("org.springframework.integration",
|
||||
"org.springframework.integration.jdbc",
|
||||
"org.springframework.jdbc",
|
||||
"org.apache.derby");
|
||||
|
||||
@BeforeClass
|
||||
public static void init() {
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
log4j.rootCategory=WARN, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n
|
||||
|
||||
log4j.category.org.springframework.integration=WARN
|
||||
log4j.category.org.apache.derby=WARN
|
||||
|
||||
log4j.category.org.springframework.jdbc=WARN
|
||||
log4j.category.org.springframework.integration.jdbc=WARN
|
||||
17
spring-integration-jdbc/src/test/resources/log4j2-test.xml
Normal file
17
spring-integration-jdbc/src/test/resources/log4j2-test.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN">
|
||||
<Appenders>
|
||||
<Console name="STDOUT" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d %p [%t] [%c] - %m%n" />
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="org.apache.derby" level="warn"/>
|
||||
<Logger name="org.springframework.jdbc" level="warn"/>
|
||||
<Logger name="org.springframework.integration" level="warn"/>
|
||||
<Logger name="org.springframework.integration.jdbc" level="warn"/>
|
||||
<Root level="warn">
|
||||
<AppenderRef ref="STDOUT" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
Reference in New Issue
Block a user