Added command line logging configuration which enables log file:

* Size limiting (--log-limit <size in bytes>)
* Rotation (--log-count <count of files>)
* Custom naming (--log-pattern <filename pattern>)
* Append (--log-append <true|false>)
Note: This is done via command line and not bukkit-settings as that would require lots of refactoring of both core server and CraftBukkit due to the current initialisation ordering and depenencies.
All settings default to that of the standard server
This commit is contained in:
stevenh
2011-07-10 18:28:57 +01:00
parent f6a06e8df4
commit 83fd8fad69
2 changed files with 32 additions and 2 deletions

View File

@@ -37,7 +37,13 @@ public class ConsoleLogManager {
a.addHandler(consolehandler);
try {
FileHandler filehandler = new FileHandler("server.log", true);
// CraftBukkit start
String pattern = (String)server.options.valueOf("log-pattern");
int limit = ((Integer)server.options.valueOf("log-limit")).intValue();
int count = ((Integer)server.options.valueOf("log-count")).intValue();
boolean append = ((Boolean)server.options.valueOf("log-append")).booleanValue();
FileHandler filehandler = new FileHandler(pattern, limit, count, append);
// CraftBukkit start
filehandler.setFormatter(consolelogformatter);
a.addHandler(filehandler);