如果我在类路径中有slf4j-api,log4j,slf4j-log4j12和commons-logging,日志记录如何工作?

时间:2016-09-07 14:31:26

标签: java spring log4j slf4j apache-commons-logging

在我们的build.gradle:

 dependencies {
        // Logging
        compile "org.slf4j:slf4j-api:$slf4jVersion"
        compile "log4j:log4j:$log4jVersion"
        compile "org.slf4j:slf4j-log4j12:$slf4jVersion"
        ....
     }

在代码中,我们使用来自slf4j库的类。 因此它看起来像这样:

我们也使用Spring框架。它内部使用commons-logging。我们的配置中没有commons-logging的排除。但我在日志文件中看到Spring登录。而且我不明白它是如何工作的(我发现它有效)。我们的配置是否正确?

P.S。

从我的观点来看,我应该添加jcl-over-slf4j并排除commons-logging,但我看到现在它正常运行。

情况是否符合预期的行为?

0 个答案:

没有答案