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

Silence slf4 warnings #676

Closed
Deraen opened this issue Dec 23, 2017 · 2 comments
Closed

Silence slf4 warnings #676

Deraen opened this issue Dec 23, 2017 · 2 comments
Milestone

Comments

@Deraen
Copy link
Contributor

Deraen commented Dec 23, 2017

New pomegranate uses new maven-resolver (aether) which uses slf4j-api for logging:

Downloading https://github.com/boot-clj/boot/releases/download/2.8.0-SNAPSHOT/boot.jar...
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.

This means that when it tries to log, it will check if classpath contains any logger implementations. We can't safely add new implementations as it is probably that users do that themselves, and having multiple loggers also causes warning.

Though Maven itself seems to include logger: http://maven.apache.org/ref/3.2.2/maven-embedder/logging.html Might be worth to investigate more on how they prevent warnings.


Some notes from Slack:

Maybe we'll need code to check project deps and only add logger if there isn't one

Or maybe slf4j-api has some method to check if logger is available... and then we can inject logger... if we can do that before it prints the warning, it would probably be most robust solution

https://github.com/qos-ch/slf4j/blob/master/slf4j-api/src/main/java/org/slf4j/LoggerFactory.java#L149

If we can manage to run code before Maven-resolver classes are loaded, we can use java.util.ServiceLoader.load to check for SLF4JServiceProvider and if none is found, add nop/simple logger to classpath

@Deraen Deraen added this to the 2.8 milestone Dec 23, 2017
@mynomoto
Copy link

Adding slf4j-nop to a project dependencies do not silence the warning, maybe this is running on a pod and we can add it there?

@alandipert
Copy link
Contributor

Fixed by 7709941

I think it's OK to add the slf4j-nop jar to the worker pod because its deps don't interfere with user deps (worker pod classpath is totally isolated)

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