2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Minecrell <minecrell@minecrell.net>
|
|
|
|
Date: Thu, 21 Sep 2017 16:14:13 +0200
|
|
|
|
Subject: [PATCH] Handle plugin prefixes in implementation logging
|
|
|
|
configuration
|
|
|
|
|
|
|
|
Currently, plugin prefixes are prepended to the log message in
|
|
|
|
the PluginLogger before passing the message to the underlying
|
|
|
|
logging framework. This is bad design because they need to be
|
|
|
|
stripped manually when using custom appenders to log messages
|
|
|
|
in a different format.
|
|
|
|
|
|
|
|
Additionally, it makes integration of alternative logging APIs hard
|
|
|
|
because all logging must go through the PluginLogger. Avoid using
|
|
|
|
PluginLogger and create a regular logger using the plugin name.
|
|
|
|
The implementation should handle plugin prefixes by displaying
|
|
|
|
logger names when appropriate.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
2023-02-20 19:02:53 +01:00
|
|
|
index 6175b04327b12e74140a0885f7326546dfaf269a..79df67daf2fe8193fd83dd6a7bfc78b3f6e524c2 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
|
|
|
+++ b/src/main/java/org/bukkit/plugin/java/JavaPlugin.java
|
2023-02-19 15:57:10 +01:00
|
|
|
@@ -44,7 +44,7 @@ public abstract class JavaPlugin extends PluginBase {
|
2021-06-11 14:02:28 +02:00
|
|
|
private boolean naggable = true;
|
|
|
|
private FileConfiguration newConfig = null;
|
|
|
|
private File configFile = null;
|
|
|
|
- private PluginLogger logger = null;
|
|
|
|
+ private Logger logger = null; // Paper - PluginLogger -> Logger
|
|
|
|
|
|
|
|
public JavaPlugin() {
|
2023-02-19 15:57:10 +01:00
|
|
|
// Paper start
|
2023-02-20 19:02:53 +01:00
|
|
|
@@ -301,8 +301,8 @@ public abstract class JavaPlugin extends PluginBase {
|
2021-06-11 14:02:28 +02:00
|
|
|
this.dataFolder = dataFolder;
|
|
|
|
this.classLoader = classLoader;
|
|
|
|
this.configFile = new File(dataFolder, "config.yml");
|
|
|
|
- this.logger = new PluginLogger(this);
|
2023-02-19 15:57:10 +01:00
|
|
|
this.pluginMeta = configuration; // Paper
|
|
|
|
+ this.logger = Logger.getLogger(description.getPrefix() != null ? description.getPrefix() : description.getName()); // Paper - Handle plugin prefix in implementation
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|