Difference between slf4j-log4j12 and log4j-over-sl

2019-03-09 19:12发布

What's the difference between slf4j-log4j12 and log4j-over-slf4j and when should each be used?

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>1.7.12</version>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>log4j-over-slf4j</artifactId>
    <version>1.7.12</version>
</dependency>

标签: java log4j slf4j
1条回答
我只想做你的唯一
2楼-- · 2019-03-09 20:12
log4j-over-slf4j

Use this if your code or some libraries you are using uses Log4j directly, but you want to use a different SLF4J binding than Log4j. It will route the Log4j API calls to SLF4J to the binding you choose. You need to remove the Log4j library from your classpath and replace it with this dependency.

slf4j-log4j12

Use this if you want to use the Log4j 1.2 binding for SLF4J.

You shouldn't use both of these libraries at the same time.

Please note also that Log4j 2 has been released.

查看更多
登录 后发表回答