SLF4J(W): No SLF4J Providers Were Found: How to Fix It

SLF4J(W): No SLF4J providers were found means SLF4J cannot find a compatible logging implementation at runtime, so it falls back to a no-operation (NOP) logger. Your application may still start, but messages sent through SLF4J will not reach the console, a log file, or your chosen logging backend. The fix is usually to add one compatible provider to the runtime classpath, then remove outdated or duplicate bindings.

Use this table to identify the most likely cause before changing dependencies.

Symptom Likely Cause Fix
Warning appears and application logs are missing No SLF4J provider is packaged at runtime Add one provider such as Logback, slf4j-simple, JUL, or the Log4j 2 adapter
Warning appears with messages about ignored StaticLoggerBinder bindings SLF4J 2.x is running with an old SLF4J 1.7 binding Replace the old binding with an SLF4J 2-compatible provider
Works in an IDE but fails in a JAR, container, or production deployment The provider is absent from the packaged runtime classpath Include the provider in the final artifact or container image
Warning appears after enabling Log4j 2 The project uses log4j-slf4j-impl with SLF4J 2.x Use log4j-slf4j2-impl instead
You do not need application logging No provider was intentionally selected Add slf4j-nop to suppress the warning deliberately

What the SLF4J Warning Means

SLF4J is a logging facade. Your application code calls SLF4J APIs such as LoggerFactory.getLogger(), but SLF4J needs a provider to decide where those messages go.

In SLF4J 2.x, providers are discovered through Java’s service-provider mechanism. A compatible provider might send messages to:

  • Logback through logback-classic
  • A basic console logger through slf4j-simple
  • Java Util Logging through slf4j-jdk14
  • Log4j 2 through log4j-slf4j2-impl
  • No output at all through slf4j-nop

When none is visible at runtime, SLF4J selects its NOP implementation. This is a warning rather than a startup failure, but it can hide the diagnostic logs you need when an application, test suite, plugin, or server misbehaves.

The important detail is the runtime classpath, not merely the dependencies listed in your build file. A dependency can be present for compilation while missing from a Docker image, shaded JAR, standalone distribution, or test process.

How to Fix No SLF4J Providers Were Found

Step 1: Inspect the Runtime Dependency Tree

First, find the resolved version of slf4j-api and identify all logging-related runtime dependencies. Do this from the same project and build configuration that produces the failing application.

For a Gradle Java application, run:

./gradlew dependencies --configuration runtimeClasspath

On Windows, run:

gradlew.bat dependencies --configuration runtimeClasspath

For Maven, run:

mvn dependency:tree

Look for these artifacts in the output:

  • org.slf4j:slf4j-api
  • org.slf4j:slf4j-simple
  • org.slf4j:slf4j-jdk14
  • org.slf4j:slf4j-nop
  • ch.qos.logback:logback-classic
  • org.apache.logging.log4j:log4j-slf4j2-impl
  • Old bindings such as log4j-slf4j-impl or JARs containing StaticLoggerBinder

You are checking for two problems:

  1. No provider appears in the runtime tree.
  2. A provider exists, but it targets a different SLF4J major version.

If the warning occurs only in tests, inspect the test runtime classpath too. If it occurs only after deployment, inspect the dependencies that actually make it into the packaged JAR, container image, or server installation.

Step 2: Choose One Logging Provider

Choose the provider that matches the logging system your application is meant to use.

Goal Provider to Add Notes
Simple console output for a small tool or test slf4j-simple Minimal setup; useful for command-line utilities
Logback configuration and appenders logback-classic Common choice for standalone Java applications
Java Util Logging integration slf4j-jdk14 Routes SLF4J calls to java.util.logging
Log4j 2 backend log4j-slf4j2-impl Use this with SLF4J 2.x
Intentionally discard logging slf4j-nop Removes the warning but keeps logs disabled

Add only one provider for the application’s main runtime. Multiple providers can create a different warning, nondeterministic behavior, or logging loops.

Do not add slf4j-nop simply to hide a warning in an application that needs diagnostic logs. It is appropriate only when silent logging is a deliberate design choice.

Step 3: Add the Provider to the Runtime Classpath

Add the provider in the application module that starts the process. A reusable library should usually depend on slf4j-api only and let the consuming application choose the provider.

For example, if you want simple console logging in a Gradle project that already defines an slf4jVersion matching its resolved SLF4J API version:

dependencies {
    runtimeOnly("org.slf4j:slf4j-simple:${slf4jVersion}")
}

For Maven, use the same SLF4J version line as slf4j-api:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>${slf4j.version}</version>
    <scope>runtime</scope>
</dependency>

If your project uses a framework BOM or dependency-management platform, let it manage the provider version rather than overriding slf4j-api separately. The provider must be compatible with the resolved SLF4J API major version.

For Logback, add ch.qos.logback:logback-classic through the same dependency-management mechanism. For Java Util Logging, add org.slf4j:slf4j-jdk14.

Step 4: Replace Old Bindings and Remove Conflicts

SLF4J 1.7-era bindings use a StaticLoggerBinder class. SLF4J 2.x uses service providers instead. An old binding may still appear in the dependency tree, but SLF4J 2.x will ignore it rather than treating it as a compatible provider.

The most common Log4j 2 migration fix is to replace this artifact:

org.apache.logging.log4j:log4j-slf4j-impl

with this one:

org.apache.logging.log4j:log4j-slf4j2-impl

Use log4j-slf4j2-impl when the resolved slf4j-api major version is 2.x. Confirm both the resolved API version and the Log4j binding in the runtime dependency tree before rebuilding.

A version upgrade can expose this problem without any code changes. For example, a Data Prepper upgrade changed its SLF4J API from 1.7.36 to 2.0.5; a binding selected for the old API line must be replaced with a provider compatible with SLF4J 2.x.

Also remove combinations that can create logging loops:

  • Do not use both log4j-to-slf4j and an SLF4J-to-Log4j provider in the same logging path.
  • Do not keep both an old Log4j SLF4J binding and log4j-slf4j2-impl.
  • Do not package Logback, slf4j-simple, and a Log4j provider together unless a framework explicitly isolates them with separate class loaders.

Step 5: Rebuild and Run the Packaged Application

Clean the build so stale artifacts do not mask a dependency change.

For Gradle:

./gradlew clean build

For Maven:

mvn clean package

Then run the same artifact, container, test command, or server process that originally showed the warning. Testing only from an IDE is not enough if production starts a JAR or Docker image with a different classpath.

The warning should disappear, and your configured logging backend should receive SLF4J messages.

Fixing Provider Problems in JARs, Containers, and Plugins

Executable and Shaded JARs

A provider may appear in your dependency tree but still be absent from an executable JAR. Common causes include declaring it as compileOnly, excluding it from a packaging task, or placing it in a test-only configuration.

For a shaded or “fat” JAR, the service-provider descriptor is especially important:

META-INF/services/org.slf4j.spi.SLF4JServiceProvider

A shading process that overwrites or drops META-INF/services entries can prevent SLF4J from discovering an otherwise present provider. Configure the shading tool to merge service descriptors, then inspect the final JAR contents and test that exact JAR.

I reproduce classpath-only failures in a clean container when an IDE launch works, because it isolates the runtime image’s dependencies from machine-specific configuration.

Docker Images

Build dependencies and runtime dependencies are often separated in multi-stage Docker builds. Make sure the final image contains the application artifact with its provider, not only the build-stage dependency cache.

Run the container locally and inspect its startup output. If the provider exists on your workstation but the warning returns inside the container, treat the image as the source of truth.

JPMS, Application Servers, and Plugin Hosts

Java modules, application servers, IDEs, security-testing tools, and game launchers may use separate class loaders. Adding a provider to an extension or plugin does not guarantee that the host application can discover it.

In these environments, the host application normally owns logging configuration. A plugin should usually use the host’s logging API or documented extension logging mechanism rather than bundling a second backend.

Special Cases for Log4j, FitNesse, and Generated Projects

Log4j 2 With SLF4J 2.x

If you intended to use Log4j 2 and see this warning, verify that log4j-slf4j2-impl is present at runtime along with the Log4j 2 backend dependencies your application requires.

A generated project can include Log4j dependencies yet still select the wrong SLF4J adapter. A reported Micronaut Starter Log4j template issue produced the warning because its generated runtime dependencies used the older Log4j SLF4J binding.

FitNesse Standalone JARs

Some standalone applications package a provider but fail to have it discovered automatically. FitNesse documents a startup override that explicitly selects its Java Util Logging provider:

java -Dslf4j.provider=org.slf4j.jul.JULServiceProvider -jar fitnesse-20240218-standalone.jar -p 9090

The -Dslf4j.provider=org.slf4j.jul.JULServiceProvider property must come before -jar. Use the actual JAR filename and startup arguments for your installation, and confirm the provider class supplied by the application’s packaged logging provider or by your selected SLF4J binding. The FitNesse workaround specifically uses org.slf4j.jul.JULServiceProvider.

Downloaded Desktop Applications

If the warning appears while launching Eclipse Installer, Burp Suite, Project Zomboid, or another downloaded application, do not copy random SLF4J JARs into its installation directory.

The warning may be harmless if the application works and the missing logs are only internal diagnostics. If functionality is broken or the vendor’s logs are missing, update or reinstall from the official source and report the exact startup output to the application vendor. Adding a global CLASSPATH entry or modifying a signed installation can create provider conflicts and make future updates fail.

How to Confirm the Fix and Prevent It Returning

A successful fix has three signs:

  1. The No SLF4J providers were found warning no longer appears during the failing launch path.
  2. Your expected backend receives log messages.
  3. The packaged application behaves the same way as your IDE or local test run.

For a quick programmatic check, print the active logger-factory class during startup:

System.out.println(org.slf4j.LoggerFactory.getILoggerFactory().getClass().getName());

If you see a NOP logger factory, SLF4J still has no usable provider. If you see a class from your selected backend, the provider has been loaded.

To prevent regressions:

  • Keep slf4j-api and its provider on compatible major versions.
  • Use a dependency-management platform or lockfile consistently across modules.
  • Check runtimeClasspath, not just compile dependencies, after framework upgrades.
  • Run a smoke test against the built JAR or container in CI.

Next, run the packaged artifact locally and confirm that the active logger factory is not the NOP implementation.

Frequently Asked Questions

Why does Gradle show no SLF4J providers were found?

Gradle usually shows the warning because the application’s runtimeClasspath contains slf4j-api but no compatible provider. Run ./gradlew dependencies --configuration runtimeClasspath, then add one runtime provider such as slf4j-simple, logback-classic, slf4j-jdk14, or log4j-slf4j2-impl. Also check whether the dependency is declared as compileOnly or excluded from the final distribution.

Is log4j-slf4j-impl compatible with SLF4J 2.x?

No. For an application running SLF4J 2.x, use org.apache.logging.log4j:log4j-slf4j2-impl instead of log4j-slf4j-impl. Confirm the resolved slf4j-api major version in the runtime dependency tree before changing the adapter.

Can I suppress the warning without enabling logging?

Yes. Add org.slf4j:slf4j-nop as the single intentional provider when you want SLF4J calls to remain silent. This removes the warning but does not preserve application logs, so it is not appropriate for services or tools that need diagnostics.

Does adding log4j-core fix the warning?

Not by itself. log4j-core is the Log4j 2 implementation, but SLF4J needs an adapter provider to route SLF4J calls into Log4j. With SLF4J 2.x, that adapter is log4j-slf4j2-impl.

Why does logging work in my IDE but not in Docker or a runnable JAR?

Your IDE may add dependencies that are absent from the packaged runtime classpath. Check the final JAR or container image for the selected provider and, for shaded JARs, preserve META-INF/services/org.slf4j.spi.SLF4JServiceProvider.

What does “No SLF4J providers were found” mean in Project Zomboid?

In Project Zomboid, it means SLF4J could not locate a compatible logging provider on the application’s runtime classpath. SLF4J then defaults to its no-operation logger implementation.