Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-19 04:50:06 +01:00
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
Dieser Commit ist enthalten in:
Ursprung
f6a06e8df4
Commit
83fd8fad69
@ -37,7 +37,13 @@ public class ConsoleLogManager {
|
|||||||
a.addHandler(consolehandler);
|
a.addHandler(consolehandler);
|
||||||
|
|
||||||
try {
|
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);
|
filehandler.setFormatter(consolelogformatter);
|
||||||
a.addHandler(filehandler);
|
a.addHandler(filehandler);
|
||||||
|
@ -62,6 +62,30 @@ public class Main {
|
|||||||
.ofType(SimpleDateFormat.class)
|
.ofType(SimpleDateFormat.class)
|
||||||
.describedAs("Log date format");
|
.describedAs("Log date format");
|
||||||
|
|
||||||
|
acceptsAll(asList("log-pattern"), "Specfies the log filename pattern")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(String.class)
|
||||||
|
.defaultsTo("server.log")
|
||||||
|
.describedAs("Log filename");
|
||||||
|
|
||||||
|
acceptsAll(asList("log-limit"), "Limits the maximum size of the log file (0 = unlimited)")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(Integer.class)
|
||||||
|
.defaultsTo(0)
|
||||||
|
.describedAs("Max log size");
|
||||||
|
|
||||||
|
acceptsAll(asList("log-count"), "Specified how many log files to cycle through")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(Integer.class)
|
||||||
|
.defaultsTo(1)
|
||||||
|
.describedAs("Log count");
|
||||||
|
|
||||||
|
acceptsAll(asList("log-append"), "Whether to append to the log file")
|
||||||
|
.withRequiredArg()
|
||||||
|
.ofType(Boolean.class)
|
||||||
|
.defaultsTo(true)
|
||||||
|
.describedAs("Log append");
|
||||||
|
|
||||||
acceptsAll(asList("b", "bukkit-settings"), "File for bukkit settings")
|
acceptsAll(asList("b", "bukkit-settings"), "File for bukkit settings")
|
||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.ofType(File.class)
|
.ofType(File.class)
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren