我正在尝试使用 slf4j-api 和 log4j-over-slf4j,但我遇到了以下警告
System.err: SLF4J: Class path contains multiple SLF4J bindings.
System.err: SLF4J: Found binding in [jar:file:/E:/developer/NewSandbox/MY_DEV_GRID_1/grid/applications/webproject/appdata/webapps/webproject-0.1.0/WEB-INF/lib/logback-classic-1.1.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
System.err: SLF4J: Found binding in [jar:file:/E:/developer/NewSandbox/MY_DEV_GRID_1/runtimes/2.0.20161021-083156/services/log/slf4j-grid-2.0.20161021-083156.jar!/org/slf4j/impl/StaticLoggerBinder.class]
System.err: SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
System.err: SLF4J: The requested version 1.7.16 by your slf4j binding is not compatible with [1.6]
System.err: SLF4J: See http://www.slf4j.org/codes.html#version_mismatch for further details.
我试图了解这些多个绑定的来源。logback-classic
如果我通过排除spring-boot-starter-logging
,我会得到如下链接错误
loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;"
这是我通过 gradle for slf4j-api 的依赖关系树
org.slf4j:slf4j-api:1.7.21 (selected by rule)
+--- org.slf4j:jcl-over-slf4j:1.7.21
| +--- org.springframework.data:spring-data-redis:1.7.6.RELEASE
| | +--- compile
| | \--- project :common
| | \--- compile
| +--- org.springframework.data:spring-data-keyvalue:1.1.5.RELEASE
| | \--- org.springframework.data:spring-data-redis:1.7.6.RELEASE (*)
| +--- org.springframework.data:spring-data-jpa:1.10.5.RELEASE
| | \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE
| | \--- compile
| +--- org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE
| | \--- org.springframework.boot:spring-boot-starter:1.4.2.RELEASE
| | +--- org.springframework.boot:spring-boot-starter-web:1.4.2.RELEASE
| | | \--- compile
| | +--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-starter-jersey:1.4.2.RELEASE
| | | \--- compile
| | +--- org.springframework.boot:spring-boot-starter-aop:1.4.2.RELEASE
| | | \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
| | +--- org.springframework.boot:spring-boot-starter-jdbc:1.4.2.RELEASE
| | | \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
| | \--- org.springframework.boot:spring-boot-starter-validation:1.4.2.RELEASE
| | \--- org.springframework.boot:spring-boot-starter-jersey:1.4.2.RELEASE (*)
| \--- org.springframework.data:spring-data-commons:1.12.5.RELEASE
| +--- org.springframework.data:spring-data-keyvalue:1.1.5.RELEASE (*)
| \--- org.springframework.data:spring-data-jpa:1.10.5.RELEASE (*)
+--- org.slf4j:jul-to-slf4j:1.7.21
| \--- org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE (*)
+--- org.slf4j:log4j-over-slf4j:1.7.21
| \--- org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE (*)
+--- org.springframework.data:spring-data-commons:1.12.5.RELEASE (*)
+--- org.springframework.data:spring-data-jpa:1.10.5.RELEASE (*)
\--- org.springframework.data:spring-data-keyvalue:1.1.5.RELEASE (*)
org.slf4j:slf4j-api:1.6.1 -> 1.7.21
+--- org.apache.bval:bval-core:0.3-incubating
| +--- org.apache.bval:org.apache.bval.bundle:0.3-incubating
| | \--- org.apache.openjpa:openjpa-maven-plugin:2.4.1
| | \--- compile
| \--- org.apache.bval:bval-jsr303:0.3-incubating
| \--- org.apache.bval:org.apache.bval.bundle:0.3-incubating (*)
\--- org.apache.bval:bval-jsr303:0.3-incubating (*)
org.slf4j:slf4j-api:1.6.3 -> 1.7.21
+--- io.swagger:swagger-core:1.5.0
| \--- io.swagger:swagger-jaxrs:1.5.0
| \--- io.swagger:swagger-jersey2-jaxrs:1.5.0
| \--- compile
\--- io.swagger:swagger-models:1.5.0
\--- io.swagger:swagger-core:1.5.0 (*)
org.slf4j:slf4j-api:1.7.5 -> 1.7.21
\--- com.microsoft.azure:adal4j:1.0.0
\--- com.microsoft.azure:azure-keyvault:0.9.3
\--- com.microsoft.sqlserver:mssql-jdbc:6.1.0.jre8
\--- compile
org.slf4j:slf4j-api:1.7.12 -> 1.7.21
\--- project :common
\--- compile
org.slf4j:slf4j-api:1.7.20 -> 1.7.21
\--- ch.qos.logback:logback-classic:1.1.7
\--- org.springframework.boot:spring-boot-starter-logging:1.4.2.RELEASE
\--- org.springframework.boot:spring-boot-starter:1.4.2.RELEASE
+--- org.springframework.boot:spring-boot-starter-web:1.4.2.RELEASE
| \--- compile
+--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE
| \--- compile
+--- org.springframework.boot:spring-boot-starter-jersey:1.4.2.RELEASE
| \--- compile
+--- org.springframework.boot:spring-boot-starter-aop:1.4.2.RELEASE
| \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
+--- org.springframework.boot:spring-boot-starter-jdbc:1.4.2.RELEASE
| \--- org.springframework.boot:spring-boot-starter-data-jpa:1.4.2.RELEASE (*)
\--- org.springframework.boot:spring-boot-starter-validation:1.4.2.RELEASE
\--- org.springframework.boot:spring-boot-starter-jersey:1.4.2.RELEASE (*)
org.slf4j:slf4j-api:1.7.22 -> 1.7.21
\--- org.springframework.data:spring-data-redis:1.7.6.RELEASE
+--- compile
\--- project :common
\--- compile
不知道我还应该尝试解决这些警告