From: Alexandre Montplaisir Date: Fri, 3 Jun 2016 19:05:24 +0000 (-0400) Subject: Clear the logger configuration before "list" tests X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=9d06e3eb07ead1ec21411259823a758375a912be;p=lttng-ust-java-tests.git Clear the logger configuration before "list" tests Loggers defined in previous tests often leak into these ones. Signed-off-by: Alexandre Montplaisir --- diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java index 674ca79..97ba4b6 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java @@ -28,6 +28,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.logging.Level; +import java.util.logging.LogManager; import java.util.logging.Logger; import org.junit.After; @@ -82,6 +83,10 @@ public class JulLegacyApiIT { */ @Before public void setup() { + /* Clear the JUL logger configuration */ + LogManager.getLogManager().reset(); + System.gc(); + loggerA = Logger.getLogger(EVENT_NAME_A); agent = LTTngAgent.getLTTngAgent(); loggerB = Logger.getLogger(EVENT_NAME_B); diff --git a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulListEventsIT.java b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulListEventsIT.java index 0c97d37..dbd5c33 100644 --- a/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulListEventsIT.java +++ b/lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulListEventsIT.java @@ -20,6 +20,7 @@ package org.lttng.ust.agent.integration.events; import java.io.IOException; import java.util.logging.Handler; +import java.util.logging.LogManager; import java.util.logging.Logger; import org.junit.After; @@ -62,6 +63,10 @@ public class JulListEventsIT extends ListEventsITBase { */ @Before public void julSetup() throws SecurityException, IOException { + /* Clear the JUL logger configuration */ + LogManager.getLogManager().reset(); + System.gc(); + loggers = new Logger[] { Logger.getLogger(LOGGER_NAME_1), Logger.getLogger(LOGGER_NAME_2), diff --git a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jListEventsIT.java b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jListEventsIT.java index c7be8c8..7c1effa 100644 --- a/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jListEventsIT.java +++ b/lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jListEventsIT.java @@ -21,6 +21,7 @@ package org.lttng.ust.agent.integration.events; import java.io.IOException; import org.apache.log4j.Appender; +import org.apache.log4j.LogManager; import org.apache.log4j.Logger; import org.junit.After; import org.junit.AfterClass; @@ -62,6 +63,10 @@ public class Log4jListEventsIT extends ListEventsITBase { */ @Before public void log4jSetup() throws SecurityException, IOException { + /* Try clearing the log4j logger configuration */ + LogManager.resetConfiguration(); + System.gc(); + loggers = new Logger[] { Logger.getLogger(LOGGER_NAME_1), Logger.getLogger(LOGGER_NAME_2),