Use a ThreadContextRule to clean up tests. Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/b41310f3 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/b41310f3 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/b41310f3
Branch: refs/heads/LOG4J2-1010&LOG4J2-1447-injectable-contextdata&better-datastructure Commit: b41310f3e5a6810b17e16bf514051fac007197f6 Parents: b25f39f Author: Gary Gregory <ggreg...@apache.org> Authored: Mon Aug 15 13:07:51 2016 -0700 Committer: Gary Gregory <ggreg...@apache.org> Committed: Mon Aug 15 13:07:51 2016 -0700 ---------------------------------------------------------------------- .../logging/log4j/core/layout/CsvParameterLayoutTest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/b41310f3/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java index 388b24a..3347aa3 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/CsvParameterLayoutTest.java @@ -30,6 +30,7 @@ import org.apache.logging.log4j.ThreadContext; import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.Logger; import org.apache.logging.log4j.junit.LoggerContextRule; +import org.apache.logging.log4j.junit.ThreadContextRule; import org.apache.logging.log4j.message.ObjectArrayMessage; import org.apache.logging.log4j.test.appender.ListAppender; import org.junit.AfterClass; @@ -61,15 +62,13 @@ public class CsvParameterLayoutTest { @Rule public final LoggerContextRule init; + @Rule + public final ThreadContextRule threadContextRule = new ThreadContextRule(); + public CsvParameterLayoutTest(final LoggerContextRule contextRule) { this.init = contextRule; } - @AfterClass - public static void cleanupClass() { - ThreadContext.clearAll(); - } - @Test public void testCustomCharset() { final AbstractCsvLayout layout = CsvParameterLayout.createLayout(null, "Excel", null, null, null, null, null,