X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=lttng-ust-java-tests-log4j%2Fsrc%2Ftest%2Fjava%2Forg%2Flttng%2Fust%2Fagent%2Fintegration%2Fevents%2FLog4jListEventsIT.java;h=241e47c843765fc00f4ae5187a600717e0382826;hb=7a4f0255e3d52ad76b194fb2e83bcdc6f641549e;hp=c7be8c84affb373f32a7cecade2b874cbdea72c4;hpb=eca27046b6f32c55dc7ceccb0821431c9be9f3af;p=lttng-ust-java-tests.git 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..241e47c 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,11 +21,12 @@ 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; -import org.junit.Before; -import org.junit.BeforeClass; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.lttng.tools.ILttngSession; import org.lttng.ust.agent.log4j.LttngLogAppender; import org.lttng.ust.agent.utils.Log4jTestUtils; @@ -41,7 +42,7 @@ public class Log4jListEventsIT extends ListEventsITBase { /** * Class setup */ - @BeforeClass + @BeforeAll public static void log4jClassSetup() { Log4jTestUtils.testClassSetup(); } @@ -49,7 +50,7 @@ public class Log4jListEventsIT extends ListEventsITBase { /** * Class cleanup */ - @AfterClass + @AfterAll public static void log4jClassCleanup() { Log4jTestUtils.testClassCleanup(); } @@ -60,8 +61,12 @@ public class Log4jListEventsIT extends ListEventsITBase { * @throws SecurityException * @throws IOException */ - @Before + @BeforeEach 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), @@ -77,7 +82,7 @@ public class Log4jListEventsIT extends ListEventsITBase { /** * Test teardown. Detach and close all log handlers. */ - @After + @AfterEach public void log4jTeardown() { for (Logger logger : loggers) { for (Appender appender : appenders) {