2011-02-20 03:14:15 +01:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
import java.util.logging.ConsoleHandler;
|
|
|
|
import java.util.logging.FileHandler;
|
|
|
|
import java.util.logging.Level;
|
|
|
|
import java.util.logging.Logger;
|
|
|
|
|
2011-02-23 13:56:36 +01:00
|
|
|
import java.util.logging.Handler; // CraftBukkit
|
|
|
|
|
2011-02-20 03:14:15 +01:00
|
|
|
public class ConsoleLogManager {
|
|
|
|
|
|
|
|
public static Logger a = Logger.getLogger("Minecraft");
|
2011-02-23 13:56:36 +01:00
|
|
|
public static Logger global = Logger.getLogger(""); // CraftBukkit
|
2011-02-20 03:14:15 +01:00
|
|
|
|
|
|
|
public ConsoleLogManager() {}
|
|
|
|
|
|
|
|
public static void a() {
|
|
|
|
ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter();
|
|
|
|
|
|
|
|
a.setUseParentHandlers(false);
|
|
|
|
ConsoleHandler consolehandler = new ConsoleHandler();
|
|
|
|
|
2011-02-23 13:56:36 +01:00
|
|
|
// CraftBukkit start
|
|
|
|
for (Handler handler: global.getHandlers()) {
|
2011-02-20 03:14:15 +01:00
|
|
|
global.removeHandler(handler);
|
|
|
|
}
|
2011-02-23 13:56:36 +01:00
|
|
|
// CraftBukkit end
|
2011-02-20 03:14:15 +01:00
|
|
|
|
|
|
|
consolehandler.setFormatter(consolelogformatter);
|
|
|
|
a.addHandler(consolehandler);
|
2011-02-23 13:56:36 +01:00
|
|
|
global.addHandler(consolehandler); // CraftBukkit
|
2011-02-20 03:14:15 +01:00
|
|
|
|
|
|
|
try {
|
|
|
|
FileHandler filehandler = new FileHandler("server.log", true);
|
|
|
|
|
|
|
|
filehandler.setFormatter(consolelogformatter);
|
|
|
|
a.addHandler(filehandler);
|
2011-02-23 13:56:36 +01:00
|
|
|
global.addHandler(filehandler); // CraftBukkit
|
2011-02-20 03:14:15 +01:00
|
|
|
} catch (Exception exception) {
|
|
|
|
a.log(Level.WARNING, "Failed to log to server.log", exception);
|
|
|
|
}
|
|
|
|
}
|
2011-02-23 13:56:36 +01:00
|
|
|
}
|