Why we have so many logging levels?

Apr 17, 2021 By Puneet verma

What is logging?

Logging is the way to keep records for the event. It can be any vital information related to that application.

Example:

Errors logs:- Helps to debug the application.
Time for the execution of the event:- to compare the performance of the application.

What are the log levels?
Log level or log severity is the categorization of the logs.

What is a different type of logging level?

Commonly used log levels are

  • Fatal
  • Error
  • Warn
  • Info
  • Debug
  • Trace

Log Levels are in order of severity:

logging level

Why we need so many log levels?

  • Each level represents a different level of urgency and severity.
  • If the log levels are used properly in your application all you need is to look at the severity first.
  • Maintaining the different levels help one to deal with them efficiently.

Example:

  • The fatal log requires top priority attention and fixes as it breaks the core functionality of the application.
  • The error log has a lower priority as compared to the fatal.
  • Info logs don't require a quick response.

Let's understand them in details.

Trace
Logging all the step of the event.

Debug
These logs help to debug the application. It's for the developer, admins etc.

Info
It contains general information you want to capture, like the timestamp of the event.

Warn
Unexpected behaviour happened in the application, but it can continue with its work.
Key business features are operating as expected.

Example:
Loss of network connectivity, the application will resume the task once it gets network.

Error
One or more functionalities are not working, preventing some functionalities from working correctly.

Fatal
One or more key business functionalities are not working, and the whole system doesn't fulfil the business functionalities.

Further Reading Material