How Do I Stop The Failed to load class "org.slf4j.impl.StaticLoggerBinder" Messages

1,957 views
Skip to first unread message

anewsome

unread,
Feb 1, 2012, 12:58:51 PM2/1/12
to sardine
I just started using the sardine and it seems to be working fine. I'm
simply retrieving a Webdav file and parsing the data. I followed the
example on the sardine web page on how to do this. However, when my
program retrieves the file, the following is printed to the console:

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.

I do have slf4j-api-1.6.2.jar in my classpath. And I put the following
import statements in my class:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

although, Netbeans tells me that they unused imports. My program seems
to work fine though. It's very simple, I don't need any logging. Does
anyone know how to make these messages go away? Sorry if this is a
stupid question, I'm still pretty new to Java.

Jon Stevens

unread,
Feb 1, 2012, 1:46:57 PM2/1/12
to sardi...@googlegroups.com
slf4j is kind of confusing at first, but once you understand it, very powerful. 

You need two jars. One is the api jar, which you have, which is pretty much just the interfaces that you need to compile your project. The other one is the actual implementation of those interfaces.

That second jar is the adapter for how the logs should be written out. For instance, there is one for log4j another for the jdk logger, etc. For that, you need to pick how you want to output your log messages as each service has different configuration requirements.

jon

anewsome

unread,
Feb 1, 2012, 6:35:42 PM2/1/12
to sardine
Thanks for the reply Jon. I didn't understand any of it but I kept re-
reading the web page referenced in the console message. I think it's
asking me to put a jar in my classpath so I put:

slf4j-nop-1.6.4.jar

in my classpath and that made the console message stop. Perfect,
that's all I needed.

Thanks, Aaron

Mirko Friedenhagen

unread,
Feb 3, 2012, 3:31:55 PM2/3/12
to sardi...@googlegroups.com
For better logging options you would probably want to use logback[1]
in production :-)
Regards Mirko

[1] http://logback.qos.ch/
--
http://illegalstateexception.blogspot.com/
https://github.com/mfriedenhagen/
https://bitbucket.org/mfriedenhagen/

Jon Stevens

unread,
Feb 3, 2012, 4:04:52 PM2/3/12
to sardi...@googlegroups.com
It is amazing to me how over engineered logging has become.

jon

Mirko Friedenhagen

unread,
Feb 3, 2012, 4:37:20 PM2/3/12
to sardi...@googlegroups.com

Good, old times printing to stderr ;-) .

Regards Mirko
--
Sent from my phone
http://illegalstateexception.blogspot.com
http://github.com/mfriedenhagen/
https://bitbucket.org/mfriedenhagen/

Reply all
Reply to author
Forward
0 new messages