Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to slf4j 2 (fatal ClassCastException on startup) #14

Open
rtyley opened this issue Sep 11, 2024 · 0 comments
Open

Upgrading to slf4j 2 (fatal ClassCastException on startup) #14

rtyley opened this issue Sep 11, 2024 · 0 comments

Comments

@rtyley
Copy link
Member

rtyley commented Sep 11, 2024

slf4j v2 no longer honours the old static binder mechanism for finding logging providers, meaning that if you upgrade to it, your logging provider & config may not be found. If you're using Logback (Play framework default), you may see a fatal runtime error on startup like this:

SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
SLF4J(W): Ignoring binding found at [jar:file:/usr/share/tag-manager/lib/ch.qos.logback.logback-classic-1.2.11.jar!/org>
SLF4J(W): See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
Oops, cannot start the server.
java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext

Logback v1.3+ copes with the new ServiceLoader mechanism for finding logging providers, and is used by Play v2.9+.

Libraries pulling in slf4j v2

@rtyley rtyley changed the title Upgrading to slf4j 2 - old static binding mechanism for finding logging providers is removed Upgrading to slf4j 2 (fatal ClassCastExceptions on startup) Sep 11, 2024
@rtyley rtyley changed the title Upgrading to slf4j 2 (fatal ClassCastExceptions on startup) Upgrading to slf4j 2 (fatal ClassCastException on startup) Sep 11, 2024
@rtyley rtyley changed the title Upgrading to slf4j 2 (fatal ClassCastException on startup) Upgrading to slf4j 2 (fatal ClassCastException on startup) Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant