logback.xml 未使用
logback.xml does not used
我正在尝试在我的 sbt 项目中使用 logback.xml。
我添加了以下依赖项:
"ch.qos.logback" % "logback-classic" % "1.2.3"
我创建了一个 logback.xml 并将其定位在:
/src/main/resources
当我在 Intellij 上 运行 时,它有时有效,有时无效。
当我 运行 jar(不是 Uber jar)时,它总是不起作用:
SLF4J: Found binding in [jar:file:/Users/***/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.7.16.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/***/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.2.3.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 [org.slf4j.impl.Log4jLoggerFactory]
我认为这个问题与类路径问题有关,排除了 SLF4J,明确指定了 logback.xml 路径,但什么都没有!
请帮忙!
我从所有依赖项和插件中排除了 "org.slf4j","ch.qos.logback" 除外,并且我在类路径中避免了多个 slf4j:
... .map( _ exclude("org.slf4j", "*")) ++ Seq("ch.qos.logback" % "logback-classic" % "1.2.3")
我正在尝试在我的 sbt 项目中使用 logback.xml。 我添加了以下依赖项:
"ch.qos.logback" % "logback-classic" % "1.2.3"
我创建了一个 logback.xml 并将其定位在:
/src/main/resources
当我在 Intellij 上 运行 时,它有时有效,有时无效。 当我 运行 jar(不是 Uber jar)时,它总是不起作用:
SLF4J: Found binding in [jar:file:/Users/***/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.7.16.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/***/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.2.3.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 [org.slf4j.impl.Log4jLoggerFactory]
我认为这个问题与类路径问题有关,排除了 SLF4J,明确指定了 logback.xml 路径,但什么都没有!
请帮忙!
我从所有依赖项和插件中排除了 "org.slf4j","ch.qos.logback" 除外,并且我在类路径中避免了多个 slf4j:
... .map( _ exclude("org.slf4j", "*")) ++ Seq("ch.qos.logback" % "logback-classic" % "1.2.3")