Resolve command logback logging problem
I just started playing with stack manager resolve command. Apparently, there is some issue with the logger used by the stack manager that throws following messages on console:
./vertx.sh resolve
2018-03-29 12:20:41.182 [main] INFO stack-manager-cache - Set resolver cache to /Users/marcin.czeczko/Work/vertx-cli-starter/vertx/.stack-manager-cache.json
2018-03-29 12:20:41.185 [main] INFO stack-manager-cache - Loading resolver cache from /Users/marcin.czeczko/Work/vertx-cli-starter/vertx/.stack-manager-cache.json
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.
What I did is:
- Used vertx-cli-starter project
- Added slf4j-api, logback-classic, logback-core jars to lib/ and to the vertx-stack.json as dependencies
- To the java exec command I added
-Dvertx.logger-delegate-factory-class-name=io.vertx.core.logging.SLF4JLogDelegateFactory
The effects are:
- When running
vertx resolvecommand prints out the SLF4J error about StaticLoggerBinder - If I run my verticle that uses logging it works just fine.
It seems that stack-manager is using different logging api. Could you please advice how can it be solved ?
Btw. the reproducer is here: https://github.com/marcinczeczko/vertx-starter-logger-issue
Looks like the slf4j is unnecessarily shaded in stack-manager.jar and causes the Failed to load class "org.slf4j.impl.StaticLoggerBinder" as it does it in the bundled jar once again - because shaded to different package shaded/org/slf4j.
I did the experiment and
- I removed the org.slf4j shading in here https://github.com/vert-x3/vertx-stack/blob/master/stack-manager/pom.xml#L269
- Excluded org.slf4j from shading in here: https://github.com/vert-x3/vertx-stack/blob/master/stack-manager/pom.xml#L250
And problems with StaticBinder gone when using logback.
I'm wondering if there is anyway to workaround that issue without rebuilding stack-manager by myself with fixed dependencies ?
I don't think it's really possible, we shaded it to avoid interference with the classpath of vertx