问题描述
DEBUG INFO WARN ERROR FATAL
哪个提供了最高的记录,这有助于解决问题? 任何人都可以提供从最高到最低的伐木的顺序或层次结构吗? 谢谢!
推荐答案
此表可能对您有帮助:
沿着第一列,您将看到日志在每个级别中的工作方式.即警告(致命,错误和警告)将被可见.对于 Off ,什么都看不见.
其他推荐答案
使用力量,读取源(摘自Priority和Level类摘要,在版本1.2.12中介绍了跟踪级别):
public final static int OFF_INT = Integer.MAX_VALUE; public final static int FATAL_INT = 50000; public final static int ERROR_INT = 40000; public final static int WARN_INT = 30000; public final static int INFO_INT = 20000; public final static int DEBUG_INT = 10000; public static final int TRACE_INT = 5000; public final static int ALL_INT = Integer.MIN_VALUE;
或 log4j api ,这很清楚.
当库决定是否打印某个语句时,它计算负责任Logger对象的有效级别(基于配置),并将其与LogEvent的级别进行比较(取决于哪种方法在代码中使用 - 跟踪/debug/.../致命).如果LogEvent的级别更大或等于Logger的级别,则将LogEvent发送到appender(s) - "打印".核心,这一切都归结为整数比较,这就是这些常数采取行动的地方.
其他推荐答案
OFF FATAL ERROR WARN INFO DEBUG TRACE ALL
问题描述
What is the hierarchy of log4j logging?
DEBUG INFO WARN ERROR FATAL
Which one provides the highest logging which would be helpful to troubleshoot issues? Can any one provide the order or hierarchy in which logging take place from highest to lowest? Thanks!
推荐答案
This table might be helpful for you:
Going down the first column, you will see how the log works in each level. i.e for WARN, (FATAL, ERROR and WARN) will be visible. For OFF, nothing will be visible.
其他推荐答案
Use the force, read the source (excerpt from the Priority and Level class compiled, TRACE level was introduced in version 1.2.12):
public final static int OFF_INT = Integer.MAX_VALUE; public final static int FATAL_INT = 50000; public final static int ERROR_INT = 40000; public final static int WARN_INT = 30000; public final static int INFO_INT = 20000; public final static int DEBUG_INT = 10000; public static final int TRACE_INT = 5000; public final static int ALL_INT = Integer.MIN_VALUE;
or the log4j API for the Level class, which makes it quite clear.
When the library decides whether to print a certain statement or not, it computes the effective level of the responsible Logger object (based on configuration) and compares it with the LogEvent's level (depends on which method was used in the code – trace/debug/.../fatal). If LogEvent's level is greater or equal to the Logger's level, the LogEvent is sent to appender(s) – "printed". At the core, it all boils down to an integer comparison and this is where these constants come to action.
其他推荐答案
OFF FATAL ERROR WARN INFO DEBUG TRACE ALL