When logging when is an error fatal?

后端 未结 4 813
既然无缘
既然无缘 2021-02-01 02:29

In logging frameworks like log4j & log4net you have the ability to log various levels of information. Most of the levels have obvious intentions (such as what a \"Debug\" lo

4条回答
  •  清酒与你
    2021-02-01 03:33

    I would use fatal if my next step is for the application to terminate, or merely not do any more subsequent work. If the application is part of a batch or there are multiple processes running, this can be useful for tracing what happened.

    If there is a chance of recovery (e.g., loss of network connection with retries for a while) I would not use a fatal.

    If I have multiple service threads activated by a main thread and one of them fails because of some bad input but the application can still serve new requests, I do not consider it fatal.

提交回复
热议问题