On Software: Logging

Quite a while ago, I was thinking about settling on a steady logging convention, after always having slightly varying versions in my different projects.

First of all, I collected some reference material, and focused on defining a set of log levels (for the severity of an entry).
And then… the topic dozed off — until now.

Starting Point: Syslog

Syslog is an old and established convention, standard (RFC 5424).
But for my liking and needs, it’s a bit too fine-grained:

Code Severity Description
0 Emergency System is unusable
1 Alert Action must be taken immediately
2 Critical Critical conditions
3 Error Error conditions
4 Warning Warning conditions
5 Notice Normal, but significant condition
6 Informational Informational messages
7 Debug Debug-level messages

My current convention

While investigating a few other logging systems, I discovered that most of them used (or are based on) a trimmed down list of these Syslog severity levels, sometimes with more or less diverging names and definitions.

So I compared them and reduced it to the most common ones, ran it through my own internal checker, and et voilà:
Based on my findings and preferences, I came up with this condensed version as my new convention, for now:

Code Severity Description
0 Critical Indication that a crucial/core functionality is no longer working. Unrecoverable, maybe even fatal failure.
1 Error Operation of the software is impaired, because a functionality ist not working (correctly).
2 Warning Indication of a potential issue, or that something unexpected happened; but the software can continue to work normally.
3 Information Notification that things are working as expected; can be ignored during normal operations.
4 Verbose Detailed information, typically only of interest when tracing and diagnosing issues, troubleshooting (‘debugging’), and during development.