diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-12-01 11:15:18 -0600 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-12-01 11:15:18 -0600 |
commit | c098854591a90a2c8d384663a00cb7cb73cef0ac (patch) | |
tree | 3bfc3b7cc70608685783312475b296b080860872 /src/main/java/net/minecraft | |
parent | 2726696652179a5ead7dc07dd39edf7dfda687f7 (diff) | |
download | craftbukkit-c098854591a90a2c8d384663a00cb7cb73cef0ac.tar craftbukkit-c098854591a90a2c8d384663a00cb7cb73cef0ac.tar.gz craftbukkit-c098854591a90a2c8d384663a00cb7cb73cef0ac.tar.lz craftbukkit-c098854591a90a2c8d384663a00cb7cb73cef0ac.tar.xz craftbukkit-c098854591a90a2c8d384663a00cb7cb73cef0ac.zip |
Forward exceptions to log4j, cleanup logger handling. Fixes BUKKIT-4948
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r-- | src/main/java/net/minecraft/server/DedicatedServer.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java index 03585b7a..1b116878 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -46,18 +46,19 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer threadcommandreader.setDaemon(true); threadcommandreader.start(); - // CraftBukkit start - TODO: See if this needs fixing - final org.apache.logging.log4j.core.Logger realLogger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); - for (org.apache.logging.log4j.core.Appender appender : realLogger.getAppenders().values()) { - if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) { - realLogger.removeAppender(appender); - } + // CraftBukkit start - TODO: handle command-line logging arguments + java.util.logging.Logger global = java.util.logging.Logger.getLogger(""); + global.setUseParentHandlers(false); + for (java.util.logging.Handler handler : global.getHandlers()) { + global.removeHandler(handler); } + global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); + final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); new Thread(new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader)).start(); - System.setOut(new PrintStream(new LoggerOutputStream(realLogger, Level.INFO), true)); - System.setErr(new PrintStream(new LoggerOutputStream(realLogger, Level.WARN), true)); + System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true)); + System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true)); // CraftBukkit end h.info("Starting minecraft server version 1.7.2"); |