[TEST] Reset test logger to default level
This commit is contained in:
parent
633905161a
commit
788d7cb451
|
@ -22,11 +22,13 @@ package org.elasticsearch.common.logging.log4j;
|
|||
import org.apache.log4j.Appender;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.elasticsearch.common.logging.ESLogger;
|
||||
import org.elasticsearch.common.logging.Loggers;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.test.ElasticsearchTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -51,6 +53,8 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testResolveMultipleConfigs() throws Exception {
|
||||
String level = Log4jESLoggerFactory.getLogger("test").getLevel();
|
||||
try {
|
||||
Path configDir = resolveConfigDir();
|
||||
Settings settings = ImmutableSettings.builder()
|
||||
.put("path.conf", configDir.toAbsolutePath())
|
||||
|
@ -71,6 +75,9 @@ public class LoggingConfigurationTests extends ElasticsearchTestCase {
|
|||
logger = ((Log4jESLogger) esLogger).logger();
|
||||
appender = logger.getAppender("console3");
|
||||
assertThat(appender, notNullValue());
|
||||
} finally {
|
||||
Log4jESLoggerFactory.getLogger("test").setLevel(level);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue