Skip to content

Commit 7b818b0

Browse files
committed
Fix SLF4J binding so JDA logs route through Bukkit logger
JDA 5.x pulls slf4j-api 2.0.x, but the binding was slf4j-simple 1.7.36 declared as 'provided' (so not even shaded). Result: SLF4J 2.0 could not discover a provider (1.7.x uses a static binder, not ServiceLoader) and fell back to NOP, while JDA's bootstrap warnings dumped to stderr and tripped Paper's System.out/err nag. - Replace slf4j-simple 1.7.36 (provided) with slf4j-jdk14 2.0.13 (compile). Routes JDA logs through java.util.logging, which Paper captures as normal plugin lines - no stderr, no nag. - Add ServicesResourceTransformer so the relocated JULServiceProvider service file matches its relocated interface path. Without it the service file content points at a non-relocated class and the binding silently fails again. Verified at runtime: ServiceLoader finds JULServiceProvider and LoggerFactory produces a JDK14LoggerAdapter.
1 parent f5727a6 commit 7b818b0

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

pom.xml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,21 @@
106106
<scope>compile</scope>
107107
</dependency>
108108

109+
<!-- SLF4J backend for JDA. JDA 5.x pulls slf4j-api 2.0.x, so the
110+
binding must also be 2.0.x (1.7.x uses a static binder that
111+
slf4j-api 2.0 cannot discover, which produces
112+
"No SLF4J providers were found" and falls back to a NOP
113+
logger). We use slf4j-jdk14 (not slf4j-simple) so JDA logs
114+
route through java.util.logging, which Paper/Bukkit capture
115+
and format as normal plugin log lines — avoiding the
116+
System.err "Nag author" warning slf4j-simple would trigger.
117+
Must be compile scope so it is shaded into the jar. -->
109118
<dependency>
110119
<groupId>org.slf4j</groupId>
111-
<artifactId>slf4j-simple</artifactId>
112-
<version>1.7.36</version>
113-
<scope>provided</scope> </dependency>
120+
<artifactId>slf4j-jdk14</artifactId>
121+
<version>2.0.13</version>
122+
<scope>compile</scope>
123+
</dependency>
114124

115125
<!-- Test dependencies -->
116126
<dependency>
@@ -222,6 +232,14 @@
222232
</filter>
223233
</filters>
224234
<minimizeJar>false</minimizeJar>
235+
<!-- Relocate the FQCNs inside META-INF/services files
236+
so SLF4J 2.0's ServiceLoader finds the relocated
237+
provider (e.g. JULServiceProvider). Without this,
238+
the relocated slf4j-jdk14 binding is never wired
239+
up and SLF4J silently falls back to NOP. -->
240+
<transformers>
241+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
242+
</transformers>
225243
</configuration>
226244
<executions>
227245
<execution>

0 commit comments

Comments
 (0)