Fix plugin loggers on server shutdown

This commit is contained in:
José Miguel Moreno
2021-06-05 13:45:15 +02:00
parent ebdde69c39
commit a72acfb245
3 changed files with 68 additions and 33 deletions

View File

@@ -0,0 +1,26 @@
package io.papermc.paper.log;
import java.util.logging.LogManager;
public class CustomLogManager extends LogManager {
private static CustomLogManager instance;
public CustomLogManager() {
instance = this;
}
@Override
public void reset() {
// Ignore calls to this method
}
private void superReset() {
super.reset();
}
public static void forceReset() {
if (instance != null) {
instance.superReset();
}
}
}

View File

@@ -19,6 +19,12 @@ public class Main {
public static boolean useJline = true;
public static boolean useConsole = true;
// Paper start - Reset loggers after shutdown
static {
System.setProperty("java.util.logging.manager", "io.papermc.paper.log.CustomLogManager");
}
// Paper end - Reset loggers after shutdown
public static void main(String[] args) {
// Paper start
final String warnWhenLegacyFormattingDetected = String.join(".", "net", "kyori", "adventure", "text", "warnWhenLegacyFormattingDetected");