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

SLF4J error #11

Closed
SturmB opened this issue May 5, 2021 · 4 comments
Closed

SLF4J error #11

SturmB opened this issue May 5, 2021 · 4 comments

Comments

@SturmB
Copy link

SturmB commented May 5, 2021

I appear to be getting a non-fatal error with this library. Starting up my app with OSThemeDetector.registerListener() in the main() method gives me this:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
@anonymousaga
Copy link

I'm getting this exact same error too.

@Dansoftowner
Copy link
Owner

Read about the SLF4J logging facade.

This library is using the SLF4J API for logging, but in your project you have to include an actual logging implementation (e.g Log4j2, Logback etc..) to make it work.

I recommend you to use Logback as your underlying logging framework.
Gradle example:

dependencies {
    ...
    implementation 'ch.qos.logback:logback-core:1.2.3'
    implementation 'ch.qos.logback:logback-classic:1.2.3'
}

Here are some articles & video tutorials in this topic:
Introduction to SLF4J
A Guide To Logback

Logback vs SLF4J vs Log4J2 - what is the difference?
Java for Beginners 13 - Logging using slf4j and logback

@Dansoftowner Dansoftowner pinned this issue Jun 16, 2021
@anonymousaga
Copy link

One question: If I don't want any logger at all, as I don't need logs, would it be better to let this error continue and let the logger be non-operational? For me, the fewer logs and residual data, the better.

@Dansoftowner
Copy link
Owner

Well, if you don't want any logs at all, you can ignore the error.
I don't recommend you to do this because if jSystemThemeDetector fails and logs some error, you won't see it.

I think you should configure Logback and set the default logger level to ERROR, so you won't see any useless debugging/informational logs, just the important ones.

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

3 participants