Skip to content

Commit f17f260

Browse files
authored
Initialize ES logging api for tests (#88022)
This commit adds initialization of the new ES logging api into ESTestCase, so that tests can begin using the new logging api.
1 parent 71ab4c4 commit f17f260

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public static void configure(final Environment environment, boolean useConsole)
124124
configure(environment.settings(), environment.configFile(), environment.logsFile(), useConsole);
125125
}
126126

127-
private static void configureESLogging() {
127+
public static void configureESLogging() {
128128
LoggerFactory.setInstance(new LoggerFactoryImpl());
129129
}
130130

test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ public static void resetPortCounter() {
221221
static {
222222
TEST_WORKER_VM_ID = System.getProperty(TEST_WORKER_SYS_PROPERTY, DEFAULT_TEST_WORKER_ID);
223223
setTestSysProps();
224+
// TODO: consolidate logging initialization for tests so it all occurs in logconfigurator
224225
LogConfigurator.loadLog4jPlugins();
226+
LogConfigurator.configureESLogging();
225227

226228
for (String leakLoggerName : Arrays.asList("io.netty.util.ResourceLeakDetector", LeakTracker.class.getName())) {
227229
Logger leakLogger = LogManager.getLogger(leakLoggerName);

0 commit comments

Comments
 (0)