Migrate to Junit 5 Jupiter
[lttng-ust-java-tests.git] / lttng-ust-java-tests-log4j2 / src / test / java / org / lttng / ust / agent / utils / Log4j2TestContext.java
index 96b26833fd34f686ce43c9aaee3928dff981342f..301ff701fa1a154725c856c0a3c55824aa6da148 100644 (file)
@@ -24,12 +24,18 @@ import java.net.URL;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.core.LoggerContext;
 
+/**
+ * Log4j 2.x test context utilities.
+ */
 public class Log4j2TestContext {
 
     private final URI configFileUri;
 
     private LoggerContext loggerContext;
 
+    /**
+     * @param configFile path to the log4j configuration file.
+     */
     public Log4j2TestContext(String configFile) {
 
         URL resource = getClass().getClassLoader().getResource(configFile);
@@ -45,15 +51,24 @@ public class Log4j2TestContext {
         }
     }
 
+    /**
+     * @return the log4j2 logger context.
+     */
     public synchronized LoggerContext getLoggerContext() {
         return loggerContext;
     }
 
+    /**
+     * Initialize the log4j2 context before running a test.
+     */
     public synchronized void beforeTest() {
         loggerContext = (LoggerContext) LogManager.getContext(
                 ClassLoader.getSystemClassLoader(), false, configFileUri);
     }
 
+    /**
+     * Dispose of the log4j2 context after running a test.
+     */
     public synchronized void afterTest() {
         loggerContext.stop();
     }
This page took 0.033548 seconds and 4 git commands to generate.