Paper/patches/server/0858-Fix-plugin-loggers-on-server-shutdown.patch
Nassim Jahnke 4af62f6d1d
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
2d009e64 Update SnakeYAML javadoc link
b4fd213c Switch Player#updateInventory deprecation for internal API annotation

CraftBukkit Changes:
f3b2b2210 SPIGOT-7376: Exception with getBlockData when hasBlockData is false
725545630 SPIGOT-7375: Fix crash breeding certain entities
b9873b0d4 Update Brigadier version with fix
68b320562 SPIGOT-7266: Found typo in CraftBukkit package
98b4d2ff8 SPIGOT-7372, SPIGOT-7373: Signs can't be edited, issues with SignChangeEvent
5f7bd4d78 SPIGOT-7371: Sign does not open edit text on placement
b4cf99d24 SPIGOT-7371: Fix editing signs with API
a2b6c2744 PR-1200: Implement open sign by side
a345bb940 SPIGOT-7368: Downgrade SpecialSource version

Spigot Changes:
723951c3 Rebuild patches
b655c57d Drop old collision API deprecated since 1.9.4
55b0fed4 Rebuild patches
2023-06-08 15:25:35 +02:00

68 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jos=C3=A9=20Miguel=20Moreno?= <josemmo@pm.me>
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 37441421a50867eeecf5cf3aed3e7096c526d7ef..2c3577c6f59e482d68c80d3d414ed43942dfcfbb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1000,6 +1000,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
net.minecrell.terminalconsole.TerminalConsoleAppender.close(); // Paper - Use TerminalConsoleAppender
} catch (Exception e) {
}
+ io.papermc.paper.log.CustomLogManager.forceReset(); // Paper - Reset loggers after shutdown
this.onServerExit();
// Paper end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 9f1b363e1a6fa4925dc4560654af8426e6908c9d..717e292040ed7779eb4b6c5fa26665d3df9024e7 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -18,6 +18,12 @@ public class Main {
public static boolean useJline = true;
public static boolean useConsole = true;
+ // Paper start - Hijack log manager to ensure logging on shutdown
+ static {
+ System.setProperty("java.util.logging.manager", "io.papermc.paper.log.CustomLogManager");
+ }
+ // Paper end
+
public static void main(String[] args) {
// Paper start
final String warnWhenLegacyFormattingDetected = String.join(".", "net", "kyori", "adventure", "text", "warnWhenLegacyFormattingDetected");