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

Created on 10 Apr 2015  路  5Comments  路  Source: tomakehurst/wiremock

created a minimum stand alone:

public class App 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        WireMockServer wireMockServer = new WireMockServer(wireMockConfig().port(8123));
        wireMockServer.start();
    }
}

and get a warning:

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 needed to add an extra Maven dependency to remove the warnings:

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.4</version>
    </dependency>

Most helpful comment

How about the case of running WireMock in the terminal with java -jar wiremock-standalone.jar? Shouldn't console logging be enabled?

$ java -jar ~/tools/wiremock-standalone-2.12.0.jar --port 9999
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.
 /$$      /$$ /$$                     /$$      /$$                     /$$
| $$  /$ | $$|__/                    | $$$    /$$$                    | $$
| $$ /$$$| $$ /$$  /$$$$$$   /$$$$$$ | $$$$  /$$$$  /$$$$$$   /$$$$$$$| $$   /$$
| $$/$$ $$ $$| $$ /$$__  $$ /$$__  $$| $$ $$/$$ $$ /$$__  $$ /$$_____/| $$  /$$/
| $$$$_  $$$$| $$| $$  \__/| $$$$$$$$| $$  $$$| $$| $$  \ $$| $$      | $$$$$$/
| $$$/ \  $$$| $$| $$      | $$_____/| $$\  $ | $$| $$  | $$| $$      | $$_  $$
| $$/   \  $$| $$| $$      |  $$$$$$$| $$ \/  | $$|  $$$$$$/|  $$$$$$$| $$ \  $$
|__/     \__/|__/|__/       \_______/|__/     |__/ \______/  \_______/|__/  \__/

port:                         9999
enable-browser-proxying:      false
no-request-journal:           false
verbose:                      false

All 5 comments

This is by design - we wanted to exclude any binding to concrete logging implementations (apart from ConsoleNotifier). Partly this is to pave the way to Android support, which (according to the folks currently running private Android forks) is made a lot easier when you can pick your own slf4j impl.

How about the case of running WireMock in the terminal with java -jar wiremock-standalone.jar? Shouldn't console logging be enabled?

$ java -jar ~/tools/wiremock-standalone-2.12.0.jar --port 9999
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.
 /$$      /$$ /$$                     /$$      /$$                     /$$
| $$  /$ | $$|__/                    | $$$    /$$$                    | $$
| $$ /$$$| $$ /$$  /$$$$$$   /$$$$$$ | $$$$  /$$$$  /$$$$$$   /$$$$$$$| $$   /$$
| $$/$$ $$ $$| $$ /$$__  $$ /$$__  $$| $$ $$/$$ $$ /$$__  $$ /$$_____/| $$  /$$/
| $$$$_  $$$$| $$| $$  \__/| $$$$$$$$| $$  $$$| $$| $$  \ $$| $$      | $$$$$$/
| $$$/ \  $$$| $$| $$      | $$_____/| $$\  $ | $$| $$  | $$| $$      | $$_  $$
| $$/   \  $$| $$| $$      |  $$$$$$$| $$ \/  | $$|  $$$$$$/|  $$$$$$$| $$ \  $$
|__/     \__/|__/|__/       \_______/|__/     |__/ \______/  \_______/|__/  \__/

port:                         9999
enable-browser-proxying:      false
no-request-journal:           false
verbose:                      false

Same issue:
How about the case of running WireMock in the terminal with java -jar wiremock-standalone.jar? Shouldn't console logging be enabled?

Run it on terminal as:
java -cp "slf4j-nop-1.7.9.jar;wiremock-standalone-2.15.0.jar" com.github.tomakehurst.wiremock.standalone.WireMockServerRunner

I had to replace the semicolon with a colon, otherwise java could not find the main class

java -cp 'wiremock.jar:slf4j-nop.jar' 'com.github.tomakehurst.wiremock.standalone.WireMockServerRunner'
Was this page helpful?
0 / 5 - 0 ratings