I've been influenced by the log levels that I and my teams have used at my last two companies. I'll share ours here but keep in mind this bit is subjective:
Now, my objective question is whether there is a highly-agreed upon style defined in this regard. The answer may be no. But if there is such a standard, can you point a URL to it?
Also note that I don't really care what threshold is actually configured to log somewhere useful in a deployed / production environment. Rather, my question is restricted to guidelines that those of us who write code should use.
I'm putting a C# tag and Java tag on my question. It's possible we'd have different guidelines in these two camps but there are probably only cultural reasons that we'd differ, not conceptual reasons.
You can expect the TRACE logging level to be very verbose. You can use it for example to annotate each step in the algorithm or each individual query with parameters in your code.
When combined with a logging framework you can easily limit the information that is written to the log destination of your choice. When setting the log level that you are interested in your logging framework you effectively limit all less important log levels to be ignored.
Log files contain a wealth of information about all of the events that take place within a system and log levels allow users to categorize those events by type and severity so they can be treated accordingly.
The log levels can help in reducing the information noise and reduce alert fatigue. Before continuing with the description of the log levels themselves it would be good to know where the log levels come from.
I'm not even sure that whether something is "highly-agreed" upon can be answered objectively.
The Log4j and Log4Net libraries certainly employ the level definitions that you've described. See this link.
Somebody might yet produce a counter-example of a library that uses a differently defined set of logging levels.
from SSCLI (.NET sources):
namespace System {
...
[Serializable]
internal enum LogLevel {
Trace = 0,
Status = 20,
Warning= 40,
Error = 50,
Panic = 100,
}
...
}
note the [warning] values) I rely on this variant of distribution. anyway it's Microsoft)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With