Loggers defined in previous tests often leak into these ones.
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
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;
import java.util.logging.Logger;
import org.junit.After;
*/
@Before
public void setup() {
*/
@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);
loggerA = Logger.getLogger(EVENT_NAME_A);
agent = LTTngAgent.getLTTngAgent();
loggerB = Logger.getLogger(EVENT_NAME_B);
import java.io.IOException;
import java.util.logging.Handler;
import java.io.IOException;
import java.util.logging.Handler;
+import java.util.logging.LogManager;
import java.util.logging.Logger;
import org.junit.After;
import java.util.logging.Logger;
import org.junit.After;
*/
@Before
public void julSetup() throws SecurityException, IOException {
*/
@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),
loggers = new Logger[] {
Logger.getLogger(LOGGER_NAME_1),
Logger.getLogger(LOGGER_NAME_2),
import java.io.IOException;
import org.apache.log4j.Appender;
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.apache.log4j.Logger;
import org.junit.After;
import org.junit.AfterClass;
*/
@Before
public void log4jSetup() throws SecurityException, IOException {
*/
@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),
loggers = new Logger[] {
Logger.getLogger(LOGGER_NAME_1),
Logger.getLogger(LOGGER_NAME_2),