Rupert Anderson's Blog

Mainly SoapUI, API, Open Source stuff and Elite Dangerous!

Issue/Fix: SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”

Introduction

This probably a minor issue for most, but the error message isn’t great and it inhibits (sometimes helpful) log messages in certain situations e.g. when running SoapUI from the shell, testrunner scripts and Maven.

Issue

You run SoapUI from the shell / terminal and you see something like:

tests-MacBook-Pro:app test$ ./bin/soapui.sh 
================================
=
= SOAPUI_HOME = /Applications/SoapUI-5.2.1.app/Contents/java/app
=
================================
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.
Configuring log4j from [/Applications/SoapUI-5.2.1.app/Contents/java/app/bin/soapui-log4j.xml]

Fix

The error just means that no suitable slf4j logger implementation can be found, as per http://www.slf4j.org/codes.html#StaticLoggerBinder – the slf4j-api-1.6.1.jar is there in <SoapUI Home>/app/java/lib already. If no suitable logger implementation is added, then the documentation explains that as of version 1.6, the nop logger implementation will be used – but this doesn’t log anything and you get the warning every time.

There are two main options here depending on how you install/use SoapUI. Taking either option should result in no error and potentially extra logging:


tests-MacBook-Pro:app test$ ./bin/soapui.sh
================================
=
= SOAPUI_HOME = /Applications/SoapUI-5.2.1.app/Contents/java/app
=
================================
Configuring log4j from [/Applications/SoapUI-5.2.1.app/Contents/java/app/bin/soapui-log4j.xml]

Option 1 – SoapUI Was Installed Using The Installer

  1. Pick an slf4j logger implementation from http://mvnrepository.com/artifact/org.slf4j  e.g. download slf4j-simple-1.6.1.jar
  2. Add it to <SoapUI Home>/java/app/lib
  3. Try to run SoapUI again and the error message should be gone and logging may be seen.

Option 2 – SoapUI Built & Run From Source Code (Using Maven)

When building and running SoapUI from source code using maven just add the dependency for the chosen logger implementation (see option 1 – step 1) to the pom.xml for the SoapUI project soapui-project/soapui/pom.xml – for example:

<!-- Logging -->
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.14</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.6.1</version>
</dependency>
<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.1.1</version>
</dependency>
<!-- In-app analytics -->

Leave a Reply