Log4j output level

For the log output level, the following are some principles we should remember:
ERROR: A serious error has occurred in the system, which must be dealt with immediately, otherwise the system will not be able to continue to run. For example, NPE (null pointer), database unavailable, etc. Exception.

WARN: The system can continue to run, but attention must be paid. The existing problems can generally be divided into two categories: one is that the system has obvious problems (for example, data is unavailable), the other is that the system has potential problems, Need to draw attention or give some advice (for example, the system is running in safe mode or the account accessing the current system has security risks). In short, the system is still available, but it is better to check and adjust.

INFO: Important business logic processing completed. Ideally, the log information of INFO should be understood by advanced users and system administrators, and the current operating status of the system can be known from the log information. For example, for a flight reservation system, when a user completes a flight reservation operation After that, the alert should give "who booked the flight from A to B". Another place where INFO information needs to be output is when a system operation causes a major change in the state of the system (eg database update, excessive system requests).

DEBUG: It is mainly for developers, and will be discussed further below.

TRACE: System details, mainly for developers. Generally speaking, if it is an online system, it can be considered as a temporary output, and it can be changed at any time through a switch. Close. Sometimes it is difficult for us to distinguish DEBUG from TRACE. In general, if it is a system that has been developed and tested, and log output is added to the system, it should be set to TRACE level.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327057037&siteId=291194637