From 6aafe7c5a10d522efbbbc671aa831062f4b57e44 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Sun, 1 Dec 2013 13:21:22 -0600 Subject: [PATCH] Make console work on Windows again. Fixes BUKKIT-4956 Something the log4j ConsoleAppender does makes the console work correctly on Windows. After trying to pull pieces of it out and run them manually I decided to just put the appender back. We now once again start with the ConsoleAppender then remove it immediately after starting. --- src/main/java/net/minecraft/server/DedicatedServer.java | 6 ++++++ src/main/resources/log4j2.xml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java index 1b11687877..30ce5f488b 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -55,6 +55,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); + for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) { + if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) { + logger.removeAppender(appender); + } + } + new Thread(new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader)).start(); System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true)); diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml index c868e8c5a9..36eff853f8 100644 --- a/src/main/resources/log4j2.xml +++ b/src/main/resources/log4j2.xml @@ -1,6 +1,7 @@ + @@ -17,6 +18,7 @@ +