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.
This commit is contained in:
parent
a96f3d46b7
commit
98a278ed95
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue