slf4j-log4j12和log4j-over-slf4j之间的区别 [英] Difference between slf4j-log4j12 and log4j-over-slf4j

查看:2461
本文介绍了slf4j-log4j12和log4j-over-slf4j之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

slf4j-log4j12和 log4j-over-slf4j 以及何时应该使用?

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>


推荐答案

log4j-over-slf4j

如果您使用的代码或某些库直接使用Log4j,但是您想要使用与Log4j不同的SLF4J绑定。它会将Log4j API调用路由到SLF4J到您选择的绑定。您需要从类路径中删除Log4j库并将其替换为此依赖项。

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

如果想要使用SLF4J的Log4j 1.2绑定,请使用此选项。请注意, Log4j 2已发布

Use this if you want to use the Log4j 1.2 binding for SLF4J. Please note that Log4j 2 has been released.

你不应该同时使用这两个库同时

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

这篇关于slf4j-log4j12和log4j-over-slf4j之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆