From 3851dd3d952cebedb5492667f437d46b55edb56b Mon Sep 17 00:00:00 2001 From: zml Date: Thu, 27 Jan 2022 20:42:15 -0800 Subject: [PATCH] Document support for the Java platform logger --- source/plugin/injection.rst | 3 ++- source/plugin/logging.rst | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/plugin/injection.rst b/source/plugin/injection.rst index a72e03df311..7db0ab6c27f 100644 --- a/source/plugin/injection.rst +++ b/source/plugin/injection.rst @@ -64,7 +64,8 @@ The following objects are the same, no matter which plugin requests the injectio The following types return an appropriate instance for the plugin: - :javadoc:`PluginContainer` - returns the plugin container associated with the plugin it is being injected into -- ``org.apache.logging.log4j.Logger`` - returns the logger associated with the plugin it is being injected into +- ``org.apache.logging.log4j.Logger`` - returns the preferred logger associated with the plugin it is being injected into +- ``System.Logger`` - returns an alternate logger using the JDK facade, supported for integration with libraries which use it Example: Injecting the Plugin Specific Logger and PluginContainer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/plugin/logging.rst b/source/plugin/logging.rst index 555125e0923..47115fb48b9 100644 --- a/source/plugin/logging.rst +++ b/source/plugin/logging.rst @@ -11,6 +11,10 @@ There are a few logging frameworks available for use in Java. Logging is prefera Sponge uses ``org.apache.logging.log4j.Logger``, not ``java.util.logging.Logger``. +Additionally, Sponge supports injection of a ``java.lang.System$Logger`` for better integration with libraries which use that framework. +While this abstraction is built into the JDK, it is also significantly more limited in functionality compared to the recommended +Log4J logger. As such, it is only useful for code that may run both within a Sponge environment, as well as on its own. + Getting a Logger ================