Fix checkstyle and test for logging output stream

Commit a156629b didn't quite fix the botched backport. This commit does.
This commit is contained in:
Ryan Ernst 2020-01-25 14:13:47 -08:00
parent a156629b4a
commit fbfc5a327c
2 changed files with 6 additions and 4 deletions

View File

@ -247,8 +247,10 @@ public class LogConfigurator {
// Redirect stdout/stderr to log4j. While we ensure Elasticsearch code does not write to those streams, // Redirect stdout/stderr to log4j. While we ensure Elasticsearch code does not write to those streams,
// third party libraries may do that // 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("stdout"), Level.INFO),
System.setOut(new PrintStream(new LoggingOutputStream(LogManager.getLogger("stderr"), Level.WARN), false, StandardCharsets.UTF_8.name())); 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() { private static void configureStatusLogger() {

View File

@ -53,9 +53,9 @@ public class LoggingOutputStreamTests extends ESTestCase {
PrintStream printStream; PrintStream printStream;
@Before @Before
public void createStream() { public void createStream() throws Exception {
loggingStream = new TestLoggingOutputStream(); loggingStream = new TestLoggingOutputStream();
printStream = new PrintStream(loggingStream, false, StandardCharsets.UTF_8); printStream = new PrintStream(loggingStream, false, StandardCharsets.UTF_8.name());
} }
public void testEmptyLine() { public void testEmptyLine() {