log4j.properties中的这些属性是什么意思? [英] What does these properties in log4j.properties mean?

查看:85
本文介绍了log4j.properties中的这些属性是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 messages
  • INFO: information that aren't problems
  • WARN: not error but something that could cause a future error
  • ERROR: something went wrong, a problem that the application manages, the application could be stopped or not, usually must be reported
  • FATAL: an error that crashes the application
  • OFF: 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).

通常在开发过程中,我设置为ALLDEBUG,而在部署时,我设置为INFOWARN.

Usually during development I set to ALL or DEBUG, while when deployed I set to INFO or WARN.

这篇关于log4j.properties中的这些属性是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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