Selection of log types: Debug, Info, Warn, error or fatal?

Source: Internet
Author: User
Tags system log
Software is unavoidable to use such as Log4net, log4j, Tracer and other things to write the log, no matter what, these things are mostly the same, generally provide such 5 log levels:
Xdebug
Xinfo
Xwarn
Xerror
Xfatal
A level is higher than a, but in the specific development, on how to choose the level of adaptation, I did not find a good article to explain. Had to write down some of the experience of their own groping.

X The general Debug level is definitely off when the system is actually running. Words too literally also knows that this level of information should only be paid attention to when debugging.
The xinfo level of information should be used to display some of the current state information of the system, so in a UI-enabled system, the log will be at this level to provide effective feedback. This feedback should be immediately displayed in the Output window of the system UI or in a prompt bar. As for programs running in the background, it opens this level of logging, which may vary depending on the system:
X Some background programs provide additional running records to view the function, you need to understand the whole system of the entire process of information, generally open the info log.
X some require the background to run more efficiently, only when there is a problem with logging, usually close the Info log.
Xerror and Fatal generally must be open, if even this level of information is not recorded, then the system log is basically meaningless.
Xwarn This flattening out level, I think the general is to open.

= = = Debug = = =
This is the lowest level of dongdong, generally speaking, in the actual operation of the system, the general is not output. So this level of information, can be used at will, any feel conducive to debugging in a more detailed understanding of the operation of the system, such as the value of variables, and so on, have lost to see it anyway. Of course, before each Debug call, be sure to add an If judgment.

= = = Info = =
This should be used to feedback the current state of the system to the end user

This thing is too hard to use, I don't want to write it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.