log4j“桥”和 RootLogger 类
我们正在尝试在 log4j“桥”。
为此,我:
- 从供应商的 JAR 中删除了所有以
org/apache/log4j/*
开头的条目 - 添加了
log4j-1.2-api-2.17.1.jar
和常规log4j-*-2.17.1.jar
文件添加到 CLASSPATH
程序终止无法找到org/apache/log4j/spi/RootLogger
。列出桥JAR的内容,我在org/apache/log4j/spi/
下找到了几个类,但是RootLogger
确实丢失了。
我该如何处理这个问题?
We're trying to force an old vendor-provided Java-program (a JAR) to use log4j2, with the help of the log4j "bridge".
To do this, I:
- Deleted all entries starting with
org/apache/log4j/*
from the vendor's JAR - Added the
log4j-1.2-api-2.17.1.jar
and the regularlog4j-*-2.17.1.jar
files to CLASSPATH
The program dies unable to find the org/apache/log4j/spi/RootLogger
. Listing the contents of the bridge JAR, I find several classes under the org/apache/log4j/spi/
, but the RootLogger
is, indeed, missing.
How do I deal with this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Log4j2 的最新版本 2.17.2 包含对 Log4j 1.x 桥的几十个修复(参见 变更日志)。
其中添加了 org.apache.log4j.RootLogger 类,以提供与 Log4j 1.x 的二进制兼容性。
警告:许多添加的类都是无操作的,只是防止
ClassNotFoundException
作为您问题中的类。The newest version 2.17.2 of Log4j2 contains a couple of dozen of fixes to the Log4j 1.x bridge (cf. changelog).
Among them the
org.apache.log4j.RootLogger
class has been added to provide binary compatibility with Log4j 1.x.Warning: many of the added classes are no-ops and just prevent
ClassNotFoundException
s as the one in your question.