Application logs are output at the following log levels.

FATAL levels:

Represents a system-level error that needs to be handled immediately. When this error occurs, it indicates that the service has become unavailable to some extent and the system administrator needs to intervene immediately. This is the most serious log level, so it must be used with caution. If logs of this level occur frequently, the log is meaningless. Normally, only one FATAL level log should be recorded during the life of a process, when the process exits due to an unrecoverable error. Of course, if a subsystem of a system encounters an unrecoverable error, the caller of that subsystem can also log to the FATAL level to alert the system administrator to fix it.

Level of the ERROR:

Errors of this level also need to be handled immediately, but with less urgency than FATAL. When an ERROR occurs, user access is affected. In this sense, ERROR errors and FATAL errors actually affect users in the same way. FATAL is equivalent to the service having already died. ERROR is equivalent to the good death rather than living. However, living cannot provide normal services, and only ERROR logs are continuously printed. In particular, ERROR and FATAL belong to the server’s own exceptions and need to be handled by human intervention immediately.

The WARN level:

This log indicates that the system may or may not have a problem, such as network fluctuation. Logs can also be recorded as WARN logs for conditions that are not currently errors but could become errors if not handled in time, such as disk usage of a storage system exceeding the threshold, or storage quota of a user in the system being used up, and so on. Logs of WARN level need to be viewed and processed even though they do not require immediate processing by the system administrator. Therefore, this level of logs should not be too much, can not hit WARN level logs, try not to hit;

INFO:

This type of log records the normal running status of the system, such as the initialization of a subsystem, the successful execution of a request, and so on. By viewing logs at the INFO level, you can quickly locate WARN,ERROR, and FATAL errors in the system.

The DEBUG level:

The specific specifications of these two types of logs should be defined by the project team. Logs at this level record the running status of each step of the system. Logs help you view the execution process of each step of an operation and locate the operation, parameters, and sequence that cause an error. It is guaranteed that problems can be diagnosed with DEBUG (or TRACE) level logs without reproducing errors. Note that the format of DEBUG logs also needs to be standardized. In addition to the developers who record logs, other personnel, such as O&M and testing personnel, can use DEBUG (or TRACE) logs to locate problems.

Reprinted from: Simple Book – fold up low

Article: www.jianshu.com/p/d81d0e48d…