diff --git a/server/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java b/server/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java index 1c74cff8651..ddaf9307c20 100644 --- a/server/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java +++ b/server/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java @@ -247,8 +247,10 @@ public class LogConfigurator { // Redirect stdout/stderr to log4j. While we ensure Elasticsearch code does not write to those streams, // third party libraries may do that - System.setOut(new PrintStream(new LoggingOutputStream(LogManager.getLogger("stdout"), Level.INFO), false, StandardCharsets.UTF_8.name())); - System.setOut(new PrintStream(new LoggingOutputStream(LogManager.getLogger("stderr"), Level.WARN), false, StandardCharsets.UTF_8.name())); + System.setOut(new PrintStream(new LoggingOutputStream(LogManager.getLogger("stdout"), Level.INFO), + false, StandardCharsets.UTF_8.name())); + System.setOut(new PrintStream(new LoggingOutputStream(LogManager.getLogger("stderr"), Level.WARN), + false, StandardCharsets.UTF_8.name())); } private static void configureStatusLogger() { diff --git a/server/src/test/java/org/elasticsearch/common/logging/LoggingOutputStreamTests.java b/server/src/test/java/org/elasticsearch/common/logging/LoggingOutputStreamTests.java index 0787ff78faf..9ee3e1a49b2 100644 --- a/server/src/test/java/org/elasticsearch/common/logging/LoggingOutputStreamTests.java +++ b/server/src/test/java/org/elasticsearch/common/logging/LoggingOutputStreamTests.java @@ -53,9 +53,9 @@ public class LoggingOutputStreamTests extends ESTestCase { PrintStream printStream; @Before - public void createStream() { + public void createStream() throws Exception { loggingStream = new TestLoggingOutputStream(); - printStream = new PrintStream(loggingStream, false, StandardCharsets.UTF_8); + printStream = new PrintStream(loggingStream, false, StandardCharsets.UTF_8.name()); } public void testEmptyLine() {