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.
This commit is contained in:
Travis Watkins 2013-12-01 13:21:22 -06:00
parent d48bcbe642
commit 6aafe7c5a1
2 changed files with 8 additions and 0 deletions

View File

@ -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));

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="net.minecraft,com.mojang">
<Appenders>
<Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
<Queue name="TerminalConsole">
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
</Queue>
@ -17,6 +18,7 @@
<filters>
<MarkerFilter marker="NETWORK_PACKETS" onMatch="DENY" onMismatch="NEUTRAL" />
</filters>
<AppenderRef ref="WINDOWS_COMPAT"/>
<AppenderRef ref="File"/>
<AppenderRef ref="TerminalConsole"/>
</Root>