log4j.properties中的这些属性是什么意思? [英] What does these properties in log4j.properties mean?
问题描述
log4j.rootCategory
字段可以具有4个不同的值,即:
log4j.rootCategory
feild in log4j.properties can have 4 different values namely:
DEBUG,WARN,INFO and ERROR
.您能告诉我哪种情况最适合吗?
DEBUG,WARN,INFO and ERROR
. Can you tell me which is most suitable for what cases?
推荐答案
从最不严重到最严重:
ALL < DEBUG < INFO < WARN < ERROR < FATAL < OFF
如果您选择其中之一,log4j将打印该类型和更严重类型的所有消息.
If you choose one of them log4j will print all messages of that type and of more severe type.
目的:
-
ALL
:打印所有消息* -
DEBUG
:调试消息 -
INFO
:没问题的信息 -
WARN
:不是错误,而是可能导致将来出现错误的东西 -
ERROR
:出了点问题,应用程序管理的问题,应用程序是否可以停止,通常必须报告 -
FATAL
:导致应用程序崩溃的错误 -
OFF
:不打印任何消息*
ALL
: prints all messages*DEBUG
: debug messagesINFO
: information that aren't problemsWARN
: not error but something that could cause a future errorERROR
: something went wrong, a problem that the application manages, the application could be stopped or not, usually must be reportedFATAL
: an error that crashes the applicationOFF
: prints no messages*
(*)这些只是关键字;对于这些类别,没有方法all(msg)
和off(msg)
,就像我们有error(msg)
或debug(msg)
一样.
(*) these are only keywords; for these categories there are no methods all(msg)
and off(msg)
, like we have error(msg)
or debug(msg)
.
通常在开发过程中,我设置为ALL
或DEBUG
,而在部署时,我设置为INFO
或WARN
.
Usually during development I set to ALL
or DEBUG
, while when deployed I set to INFO
or WARN
.
这篇关于log4j.properties中的这些属性是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!