从log4j2桥接到slf4j [英] Bridging from log4j2 to slf4j

查看:968
本文介绍了从log4j2桥接到slf4j的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序(这是一个Dropwizard应用程序)中将Slf4j 1.7.x与Logback结合使用.现在,我们有了使用log4j2(而不是log4j)的库,日志记录转到了/dev/null.在任何现有的Maven应用程序中都找不到logj2-over-slf4jlog4j2-to-slf4j库,诀窍是什么?

I'm using Slf4j 1.7.x in conjunction with Logback in my applications (it is a Dropwizard-application). Now we have libraries that use the log4j2 (not log4j), and the logging goes to /dev/null. I can't find a logj2-over-slf4j or log4j2-to-slf4j library in any exising maven application, what is the trick?

推荐答案

您可以使用 Log4j 2到SLF4J适配器,以将Log4j2日志路由到slf4j实现.没错,slf4j本身不提供log4j2的适配器.

You may use the Log4j 2 to SLF4J Adapter to route your Log4j2 logs to your slf4j implementation. You are right that slf4j itself does not provide an adapter for log4j2.

这篇关于从log4j2桥接到slf4j的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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