开发者

In logging what is the conceptual difference between Level.INFO and Level.DEBUG

开发者 https://www.devze.com 2023-01-15 02:01 出处:网络
This question is language-agnostic. What is the difference between the enumerated levels. In applications I\'ve seen many INFO messages 开发者_开发知识库that seemed DEBUG info to me and vice-versa.Wel

This question is language-agnostic. What is the difference between the enumerated levels. In applications I've seen many INFO messages 开发者_开发知识库that seemed DEBUG info to me and vice-versa.


Well, there are a number of different interpretations for this. My personal opinion is:

  • INFO - information relating to the status or progress of the application. This is where information that would be useful to determine the current state of the application should be written.
  • DEBUG - information related to internal processes or failures in the application. This is where failures and diagnostic information should be written.

None of the above is standardized, but represents my opinion and observations.


This Article on ddj.com covers this topic besides others. Although it says "BAsic" instead of "Info", which is probably more correct:

* Logging Class 0: Basic
      o Data sources/documents/connections opened and closed
      o Size or number of items in opened documents
      o Commands executed
      o User or requester information
      o All messages shown to users
      o All answers/choices users have made 
* Logging Class 1: Extended
      o Information from certain important functions called, such as executed or passed program paths.
      o Information about received and processed events/requests
      o All status information shown to users 
* Logging Class 2: Debug
      o Information from within loops for all iterations
      o Extensive data dumps
      o Additional debug information 


My rule of thumb is that if you turn debug logging on for some component, the log should go so fast that it's exciting to watch, whereas if you turn info logging on, the log should go so slowly that it's calming to watch.

You can then regulate the log level according to your mood: if you're doing some hacking, you need stimulation, so you turn on debug logging and get into the flow of what's happening; if you're monitoring a build or a test run, you turn on info logging, and observe that everything is ticking over nicely.


i'd say, the conceptual difference is the target audience. "info" is for users working with an application, "debug" is for developers working on the application itself.

0

精彩评论

暂无评论...
验证码 换一张
取 消