Clear the logger configuration before "list" tests
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 3 Jun 2016 19:05:24 +0000 (15:05 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Fri, 3 Jun 2016 19:24:25 +0000 (15:24 -0400)
Loggers defined in previous tests often leak into these ones.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulLegacyApiIT.java
lttng-ust-java-tests-jul/src/test/java/org/lttng/ust/agent/integration/events/JulListEventsIT.java
lttng-ust-java-tests-log4j/src/test/java/org/lttng/ust/agent/integration/events/Log4jListEventsIT.java

index 674ca7985b9bff499d821b563a53c7f169fc4af7..97ba4b694049299795b686e4aecde7b66c7d83d0 100644 (file)
@@ -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);
index 0c97d37ae86f91d1bfc01f679727370f916805cb..dbd5c334e5bfd15aa14633116b56b941213f5b5a 100644 (file)
@@ -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),
index c7be8c84affb373f32a7cecade2b874cbdea72c4..7c1effa054f09fd67daf547e8b24c5193c3ed436 100644 (file)
@@ -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),
This page took 0.031284 seconds and 4 git commands to generate.