aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0750-Fix-plugin-loggers-on-server-shutdown.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-05-29 13:58:57 -0700
committerGitHub <[email protected]>2024-05-29 22:58:57 +0200
commita31dc90741ed9c121a13a3c124c9ebf5bafd0da7 (patch)
tree81963bd94fe7772ee08bd21710230de21b6b25da /patches/server/0750-Fix-plugin-loggers-on-server-shutdown.patch
parented85aac53cfd93d29fa24e6071dbdddd0e49624b (diff)
downloadPaper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.tar.gz
Paper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.zip
Several fixes and new api for experience merging/stacking (#9242)
Diffstat (limited to 'patches/server/0750-Fix-plugin-loggers-on-server-shutdown.patch')
-rw-r--r--patches/server/0750-Fix-plugin-loggers-on-server-shutdown.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/patches/server/0750-Fix-plugin-loggers-on-server-shutdown.patch b/patches/server/0750-Fix-plugin-loggers-on-server-shutdown.patch
new file mode 100644
index 0000000000..8a41141be3
--- /dev/null
+++ b/patches/server/0750-Fix-plugin-loggers-on-server-shutdown.patch
@@ -0,0 +1,67 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Moreno?= <[email protected]>
+Date: Sat, 5 Jun 2021 13:45:15 +0200
+Subject: [PATCH] Fix plugin loggers on server shutdown
+
+
+diff --git a/src/main/java/io/papermc/paper/log/CustomLogManager.java b/src/main/java/io/papermc/paper/log/CustomLogManager.java
+new file mode 100644
+index 0000000000000000000000000000000000000000..c1d3bac79bb8b4796c013ff4472f75dcd79602dc
+--- /dev/null
++++ b/src/main/java/io/papermc/paper/log/CustomLogManager.java
+@@ -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();
++ }
++ }
++}
+diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
+index 803c234ec23147ed317ae4639438141462dfbd80..f67b48131ec7e18177f5daeda19389641f00193a 100644
+--- a/src/main/java/net/minecraft/server/MinecraftServer.java
++++ b/src/main/java/net/minecraft/server/MinecraftServer.java
+@@ -1232,6 +1232,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
+ } catch (Exception ignored) {
+ }
+ // CraftBukkit end
++ io.papermc.paper.log.CustomLogManager.forceReset(); // Paper - Reset loggers after shutdown
+ this.onServerExit();
+ }
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
+index 02243b69cca7255588b43dab57e1c9ca4c3ca87f..6e1f92b45504cef0c4dcbbebf3df339ef4cad0a1 100644
+--- a/src/main/java/org/bukkit/craftbukkit/Main.java
++++ b/src/main/java/org/bukkit/craftbukkit/Main.java
+@@ -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");