Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

SLF4J to Log4j Bridge missing #21

Closed
mdonkers opened this issue Feb 20, 2016 · 5 comments
Closed

SLF4J to Log4j Bridge missing #21

mdonkers opened this issue Feb 20, 2016 · 5 comments

Comments

@mdonkers
Copy link

Hi,

When adding akka-log4j I'm receiving the following error message:

[ERROR] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[ERROR] SLF4J: Defaulting to no-operation (NOP) logger implementation
[ERROR] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

This can be easily fixed by adding the following dependency:

"org.apache.logging.log4j" % "log4j-slf4j-impl" % Version.Log4j

It prevents other projects from having to add this library themselves.

BR,
Miel

@hseeberger
Copy link
Owner

Where does that error message come from?

@mdonkers
Copy link
Author

When starting the application. I presume when SLF4J is being initialized. This is the full log upon application startup:

[info] Starting application coffee in the background ...
coffee Starting nl.codecentric.coffee.CoffeeApp.main()
[success] Total time: 0 s, completed Feb 20, 2016 8:46:25 PM
2. Waiting for source changes... (press enter to interrupt)
coffee[ERROR] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
coffee[ERROR] SLF4J: Defaulting to no-operation (NOP) logger implementation
coffee[ERROR] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

After I added the Log4J2 - SLF4J bridge:

[info] Application coffee not yet started
[info] Starting application coffee in the background ...
coffee Starting nl.codecentric.coffee.CoffeeApp.main()
[success] Total time: 0 s, completed Feb 22, 2016 10:03:04 AM

See also here: http://www.slf4j.org/codes.html#StaticLoggerBinder

@hseeberger
Copy link
Owner

Why is SLF4J used at all? This project is about Log4j. Could you please track down where in your app SLF4J is used? If you added it, please remove it or use that bridge, but in that case there's no need to add the bridge to this project.

@mdonkers
Copy link
Author

Well, if I'm not mistaken then Akka Logging is depending on SLF4J as facade for other logging implementations; http://doc.akka.io/docs/akka/2.4.1/java/logging.html#SLF4J
So SLF4J comes with Akka automatically.

I don't fully understand why its still using Log4J to output the logging, so I'll look into that. But normally the bridge would always be necessary.

@hseeberger
Copy link
Owner

No, Akka is flexible with regard to logging backends. SLF4J is just one option as is Log4j. Please read the docs carefully ;-)

Which logging backend library are you using?

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

No branches or pull requests

2 participants