-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Improve logging robustness #13622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Improve logging robustness #13622
Conversation
This fixes a race where a late log message to the async appender could cause console reinitialization during shutdown
This ensures any plugin log messages holding classloader scoped context get printed before the classloader is closed, avoiding certain plugin errors being unloggable.
|
Last updated for: 17a34a8bc08925b4c2f6c413b2f2013b7f64a390. Download the Paperclip jar for this pull request: paper-13622.zip Maven PublicationThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven("https://maven-prs.papermc.io/Paper/pr13622") {
name = "Maven for PR #13622" // https://github.com/PaperMC/Paper/pull/13622
mavenContent {
includeModule("io.papermc.paper", "dev-bundle")
includeModule("io.papermc.paper", "paper-api")
}
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Improves shutdown-time logging behavior to avoid races with Log4j async logging and plugin-classloader-scoped log messages during plugin disable/unload.
Changes:
- Adds an explicit
flush(timeout, unit)API to Log4j’sAsyncAppendervia a Paper patch. - Flushes Log4j async appenders during plugin disable before unloading plugin classloaders.
- Moves/removes some shutdown-time logging cleanup steps from
MinecraftServershutdown flow intoLogManagerShutdownThread.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
paper-server/src/main/java/io/papermc/paper/util/LogManagerShutdownThread.java |
Adds additional shutdown cleanup (force reset + terminal console close) around Log4j shutdown. |
paper-server/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java |
Flushes Log4j async appenders during plugin disable to prevent late log processing after classloader close. |
paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch |
Removes terminal console close + log manager reset from the server’s shutdown routine. |
paper-server/patches/features/0032-Add-explicit-flush-support-to-Log4j-AsyncAppender.patch |
Introduces explicit flush support to Log4j async logging internals. |
paper-server/patches/features/0028-Optimize-Hoppers.patch |
Patch metadata/index adjustment only. |
paper-server/patches/features/0025-Optimise-EntityScheduler-ticking.patch |
Patch metadata/index adjustment only. |
paper-server/patches/features/0020-Incremental-chunk-and-player-saving.patch |
Patch metadata/index adjustment only. |
paper-server/patches/features/0001-Moonrise-optimisation-patches.patch |
Patch metadata/index adjustment only. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This fixes a race where a late log message to the async appender could cause console reinitialization during shutdown
Also fixes issues when plugin log messages with classloader scoped context tries to print after the plugin classloader is closed by flushing the async appender as a part of disabling plugins.