From 98a278ed95e4cbab00c8ac86ca40a7f55b7f19c6 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 6 Sep 2016 20:35:03 -0400 Subject: [PATCH] Shutdown logging in logging evil tests The evil logging tests write to log files which are deleted at the end of the test. If these files are not closed, some operating systems will complain when these deletes are performed. This commit ensures that the logging system is properly shutdown so that these files can be properly deleted. --- .../elasticsearch/common/logging/EvilLoggerTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qa/evil-tests/src/test/java/org/elasticsearch/common/logging/EvilLoggerTests.java b/qa/evil-tests/src/test/java/org/elasticsearch/common/logging/EvilLoggerTests.java index 168453df763..23eb0744580 100644 --- a/qa/evil-tests/src/test/java/org/elasticsearch/common/logging/EvilLoggerTests.java +++ b/qa/evil-tests/src/test/java/org/elasticsearch/common/logging/EvilLoggerTests.java @@ -20,7 +20,10 @@ package org.elasticsearch.common.logging; import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.config.Configurator; import org.elasticsearch.Version; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.settings.Settings; @@ -59,6 +62,13 @@ public class EvilLoggerTests extends ESTestCase { deprecationLogger = ESLoggerFactory.getDeprecationLogger("test"); } + @Override + public void tearDown() throws Exception { + LoggerContext context = (LoggerContext) LogManager.getContext(false); + Configurator.shutdown(context); + super.tearDown(); + } + public void testLocationInfoTest() throws IOException { testLogger.error("This is an error message"); testLogger.warn("This is a warning message");