Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.8.0
-
None
-
None
Description
Log4J/SLF4J Binding is broken in james-server-spring-app, starting with 3.7.2.
Server startup of 3.7.2:
C:\bin\james-server-spring-app-3.7.2\bin>run.bat SLF4J: No SLF4J providers were found. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See https://www.slf4j.org/codes.html#noProviders for further details. SLF4J: Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier. SLF4J: Ignoring binding found at [jar:file:/C:/bin/james-server-spring-app-3.7.2/lib/log4j-slf4j-impl-2.17.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See https://www.slf4j.org/codes.html#ignoredBindings for an explanation. 15 James WARN [main] openjpa.Runtime - An error occurred while registering a ClassTransformer with PersistenceUnitInfo: name 'James', root URL [file:/C:/bin/james-server-spring-app-3.7.2/conf]. The error has been consumed. To see it, set your openjpa.Runtime log level to TRACE. Load-time class transformation will not be available. 9281 James INFO [main] openjpa.Runtime - Starting OpenJPA 3.2.0
Issue was introduced with commit 3460270c3a928da6ee650194a9d4f1a08e53947e by TRAN at 2022-09-20:
slf4j.version has been changed from 1.7.36 to 2.0.1
SLF4J 2 requires updated SLF4J to Log4j Adapters:
SLF4J 2 ServiceLoader mechanism to find its logging backend
https://www.slf4j.org/faq.html#changesInVersion200
https://logging.apache.org/log4j/2.x/log4j-slf4j-impl/
Due to a break in compatibility in the SLF4J binding, as of release 2.19.0 two SLF4J to Log4j Adapters are provided.
...
2. log4j-slf4j2-impl should be used with SLF4J 2.0.x releases or newer.
To fix the issue, the 3 pom.xml referencing artifactId log4j-slf4j-impl should reference artifactId log4j-slf4j2-impl instead (- log4j2.version is already set to 2.19.0, ):
$ grep -r --include="pom.xml" "log4j-slf4j-impl" * pom.xml: <artifactId>log4j-slf4j-impl</artifactId> server/apps/spring-app/pom.xml: <artifactId>log4j-slf4j-impl</artifactId> server/container/spring/pom.xml: <artifactId>log4j-slf4j-impl</artifactId>