Play Framework 2和多个slf4j绑定

时间:2014-07-30 14:40:32

标签: logging binding playframework log4j slf4j

启动Play应用程序时,我收到有关多个slf4j绑定的警告:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/MyPrograms/play-2.2.1/repository/local/ch.qos.logback/logback-classic/1.0.13/jars/logback-classic.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/MyPrograms/play-2.2.1/repository/cache/org.apache/phoenix/jars/phoenix-2.2.3-incubating-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

我试图从第二个罐子中排除几乎所有东西,但没有成功。

"org.apache" % "phoenix" % "2.2.3-incubating-client"
   exclude("org.slf4j", "slf4j-api")
   exclude("org.slf4j", "slf4j-log4j")
   exclude("org.slf4j", "slf4j-log4j12")
   exclude("org.slf4j", "slf4j-impl")
   exclude("org.apache.logging.log4j", "log4j-slf4j-impl")
   exclude("log4j", "log4j"),

现在我只从Play控制器获取日志,而不是内部jar中的日志。我怎么知道要排除什么?有没有办法(或需要)排除第一个绑定(来自Play本地存储库jar)?

1 个答案:

答案 0 :(得分:1)

某些修补程序已在master上合并:https://github.com/playframework/playframework/issues/3206