SLF4Bukkit is an SLF4J binding that uses Bukkit's plugin logging system.
If you were linked here by documentation for a plugin that you're using on your Bukkit/Spigot server, go here to learn what configuration options you have available (and please ask the plugin developer to fix their links!).
If you wish to use SLF4J in your Bukkit plugin, or if your plugin has a dependency on a library that uses SLF4J:
- Reference the rjenkinsjr Maven2 Repository in your POM.
- Shade SLF4Bukkit into your plugin project:
<dependency>
<groupId>info.ronjenkins</groupId>
<artifactId>slf4bukkit</artifactId>
<version>1.0.0</version>
</dependency>
- (Optional) Add your desired default configuration values to your plugin's built-in config.yml file. For more details, see the Javadocs for the BukkitLoggerAdapter class.
- (Optional) Use the SLF4J API in your code.
- SLF4Bukkit supports only ColorMarkers, which format the entire message and associated throwable (if any). All other markers are discarded. ColorMarkers always override the default level-specific formatting defined in the plugin config.
- In addition to using ColorMarkers, you can use Bukkit's
ChatColor
values to further format your message. - SLF4Bukkit issues
ChatColor.RESET
after every log message, so you don't have to worry about resetting after each message. - You can use the ColorString class to easily create colored log messages.
- For a consistent user experience, it's recommended that you perform all logging via SLF4Bukkit and not use
Plugin.getLogger()
. - Any color-related features are silently stripped/ignored when SLF4Bukkit runs on a Bukkit implementation where JAnsi is not available (e.g. PaperSpigot).