Logging Levels
Careful use of logging levels will make your applications easier to manage.
Logging frameworks make use of levels to assign a relative importance to each event.
Seq can use logging levels to determine how long an event is stored - for example, events useful in debugging may be kept a few days, while those that establish how a user interacted with the system may be kept longer.
The section below is intended as a guide that you can share with your team to drive consistent use of logging levels in your applications.
Choose the Right Level
It's important to choose the right level when writing an event.
Seq uses Serilog's level system, mapping from NLog or SLAB levels as necessary.
Verbose
Verbose is the noisiest level, generally used only as a last resort when debugging a difficult problem, and rarely (if ever) enabled for a production app.
For example, local variables within an algorithm implementation might be logged at this level.
Debug
Debug is used for internal system events that are not necessarily observable from the outside, but useful when determining how something happened.
For example, the details of requests and responses made to and from external integration points would often be logged at this level.
Information
Information events describe things happening in the system that correspond to its responsibilities and functions. Generally these are the observable actions the system can perform.
For example, processing a payment or updating a user's details will be logged at this level.
Warning
When service is degraded, endangered, or may be behaving outside of its expected parameters, Warning level events are used.
A warning event should only be emitted when the condition is either transient or can be investigated and fixed - use restraint to avoid polluting the log with spurious warnings.
For example, slow response times from a critical database would be logged as warnings.
Error
When functionality is unavailable or expectations broken, an Error event is used.
For example, receiving an exception when trying to commit a database transaction is an event at this level.
Fatal
The most critical level, Fatal events demand immediate attention.
For example, an application failing during startup will log a Fatal event.
If you have a pager, it goes off when one of these occurs.
Updated less than a minute ago