Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load class "org.slf4j.impl.StaticLoggerBinder" #49

Open
efranca opened this issue Mar 1, 2022 · 4 comments
Open

Failed to load class "org.slf4j.impl.StaticLoggerBinder" #49

efranca opened this issue Mar 1, 2022 · 4 comments

Comments

@efranca
Copy link

efranca commented Mar 1, 2022

I am testing the library and it works just fine in dev, but when I run my jar I get this:

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.

Should slf4j dependencies (below) be added manually in order to work out?

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

Thanks!

@efranca
Copy link
Author

efranca commented Mar 1, 2022

Due to this conflict (warning)

[WARNING] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Dependencies with duplicate files detected. The dependencies [ch.qos.logback:logback-classic::jar:1.2.10[paths: /home/me/.m2/repository/ch/qos/logback/logback-classic/1.2.10/logback-classic-1.2.10.jar;], org.jboss.slf4j:slf4j-jboss-logmanager::jar:1.1.0.Final[paths: /home/me/.m2/repository/org/jboss/slf4j/slf4j-jboss-logmanager/1.1.0.Final/slf4j-jboss-logmanager-1.1.0.Final.jar;]] contain duplicate files, e.g. org/slf4j/impl/StaticMDCBinder.class

I had added this exclusion

<dependency>
      <groupId>io.quarkiverse.logging.logback</groupId>
      <artifactId>quarkus-logging-logback</artifactId>
      <version>0.10.0</version>
      <exclusions>
        <exclusion>
          <groupId>org.jboss.slf4j</groupId>
          <artifactId>slf4j-jboss-logmanager</artifactId>
        </exclusion>
      </exclusions> 
    </dependency>

and apparently it was good. In fact, It works just fine in DEV mode only. When I run the uber-jar it does not work as expected and throws the exception below

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.

If I comment out the exclusion above (for slf4j-jboss-logmanager) the LOGBACK works, but the WARNING duplicate is back.

I'll have to live with this warning if I want to use logback in prod.

@stuartwdouglas
Copy link
Contributor

Do you have a reproducer?

@efranca
Copy link
Author

efranca commented Mar 2, 2022

yes, would you mind taking a look at? it's here: https://github.com/efranca/quarkus-logback-demo

@mmitya
Copy link

mmitya commented Mar 30, 2022

Hi, any workaround for this, please?
I can reproduce with:

  • quarkus-logging-logback 0.4.0
  • quarkus 2.2.0

It looks like StaticLoggerBinding from logback is ignored and not packaged into uberjar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants