jdeferred / jdeferred

Java Deferred/Promise library similar to JQuery.

Home Page:jdeferred.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".

bagage opened this issue · comments

I started an empty Android project and added only a new dependency in build.gradle:

compile 'org.jdeferred:jdeferred-android-aar:+'

Then I simply added the following statement in MainActivity.java:

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        new DeferredObject<>(); //add this
    }
}

As soon as the last line is executed, you'll see the following in logs:

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

What did I do wrong here? Is there any way to get rid of them noisy logs?

Thanks!

Hi @bagage! You haven't done anything wrong - but you may want to refer to https://www.slf4j.org/codes.html#StaticLoggerBinder to see the resolutions.

To avoid any kind of class conflicts and logger conflicts, JDeferred does not include any logger libraries. We do use SLF4J as the primary logging interface, but SLF4J needs to use an actual Logger library. If none is in your classpath, SLF4J fallsback to NOP logger implementation.

Including Android logger binding could help: https://www.slf4j.org/android/

Cheers,

Thanks @saturnism for the detailed clarification, it's good to be be sure I wasn't doing anything wrong with jdeferred! Since I don't care much about jdeferred logs, I simply explicitly added a dependency to slf4j-nop together with jdeferred:

    compile 'org.slf4j:slf4j-nop:1.7.25' 

And now warnings are gone. Hourray! Thanks again :).