【发布时间】:2023-03-06 04:29:01
【问题描述】:
我正在尝试将 log4j 升级到 log4j2。我正在尝试升级的特定代码行是:
log(targetClass, Priority.DEBUG_INT, message, null);
静态字段Priority.DEBUG_INT 在新的Priority 中不再可用。相反,它看起来像 getPriority(Facility facility, org.apache.logging.log4j.Level level) 静态方法用于访问优先级 int 值,DEBUG 可以指定为 Level。
但是,此方法还需要指定 Facility。调用getPriority时如何知道指定哪个Facility?
旧优先级:https://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Priority.html
新优先级:https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/net/Priority.html
新设施:https://logging.apache.org/log4j/log4j-2.8/log4j-core/apidocs/org/apache/logging/log4j/core/net/Facility.html
【问题讨论】:
-
this?如果这些是您的消息,它肯定看起来像
1