Earlier quoted context omitted.
Can you please explain this? That sounds like identifying bugs but not fixing them but I realize you don’t mean that. One hopes the context information in the error will make it actionable when it occurs, never completely successfully, of course.
You can hope that the person reading the context will always able to understand it like you would have. Bad assumption in my experience.
Log level 'error' should mean that something needs to be fixed
171–180 of 313 posts
Re: Log level 'error' should mean that something needs to be fixed
#172> When implementing logging, it's important to distinguish between an error from the perspective of an individual operation and an error from the perspective of the overall program or system. Individual operations may well experience errors that are not error level log events for the overall program. You could say that an operation error is anything that prevents an operation from completing successfully, while a pro…
Libraries should not log on levels above DEBUG, period. If there’s something worthy for reporting on higher levels, pass this information to client code, either as an event, or as an exception or error code.
Re: Log level 'error' should mean that something needs to be fixed
#173> When implementing logging, it's important to distinguish between an error from the perspective of an individual operation and an error from the perspective of the overall program or system. Individual operations may well experience errors that are not error level log events for the overall program. You could say that an operation error is anything that prevents an operation from completing successfully, while a pro…
Libraries should not log, instead they should allow registering hooks which get called with errors and debug info.
Re: Log level 'error' should mean that something needs to be fixed
#174Earlier quoted context omitted.
> The main difference therefore between error and warning is, "We didn't think this could happen" vs "We thought this might happen". What about conditions like "we absolutely knew this would happen regularly, but it's something that prevents the completion of the entire process which is absolutely critical to the organization" The notion of an "error" is very context dependent. We usually use it to mean "can not proc…
Those conditions would be "Critical", no? The error vs warning distinction doesn't apply.
Crashing your web stack because one route hit an error is a dumb idea.
And no, calling it a warning is also dumb idea. It is an error.
This article is a navel gazing expedition.
They're kind of right but you can turn any warning into an error and vice versa depending on business needs that outweigh the technical categorisation.
Re: Log level 'error' should mean that something needs to be fixed
#175if error == NULL and operationFailed then log error Otherwise Let client side do the error handling (in terms of logging)
Re: Log level 'error' should mean that something needs to be fixed
#176Earlier quoted context omitted.
I think an example where libraries could sensibly log error is if you have a condition which is recoverable but may cause a significant slowdown, including a potential DoS issue, and the application owner can remediate. You don't want to throw because destroying someone's production isn't worth it. You don't want to silent continue in that state because realistically there's no way for application owner to understand…
In such scenarios it makes sense to give clients an opportunity to react on such conditions programmatically, so just logging is wrong choice and if there’s a call back to client, client can decide whether to log it and how.
It’s very rarely realistic that a client would code up meaningful paths for every possible failure mode in a library. These callbacks are usually reserved for expected conditions.
Re: Log level 'error' should mean that something needs to be fixed
#177Earlier quoted context omitted.
This is why it’s almost always wrong for library functions to log anything, even on ”errors”. Pass the status up through return values or exceptions. As a library author you have no clue as how an application might use it. Multi threading, retry loops and expected failures will turn what’s a significant event in one context into what’s not even worthy of a debug log in another. No rule without exceptions of course, o…
This seems like such an obvious answer to the problem, your program isn't truly modularized if logging is global. If an error is unexpected it should bubble all the way up, but if it's expected and dealt with, the error message should be suppressed or its type changed to a warning.
Re: Log level 'error' should mean that something needs to be fixed
#178That said, the thing I've cone find being useful as a subcategory of error are errors due to data problems vs errors due to other issues.
Re: Log level 'error' should mean that something needs to be fixed
#179Earlier quoted context omitted.
From a code modularization point of view, there shouldn’t really be much of a difference between programs and libraries. A program is just a library with a different calling convention. I like to structure programs such that their actual functionality could be reused as a library in another program. This is difficult to reconcile with libraries only logging on a debug level.
The main difference is that library is not aware of the context of the execution of the code, so cannot decide, whether the problem is expected, recoverable or severe.
It’s very reasonable that a logging framework should allow higher levels to adjust how logging at lower levels is recorded. But saying that libraries should only log debug is not. It’s very legitimate for a library to log “this looks like a problem to me”.
Re: Log level 'error' should mean that something needs to be fixed
#180You’re kind of telling a story to future potential trouble-shooters.
When you don’t think about it at all (it doesn’t take much), you tend to log too much and too little and at the wrong level.
But this article isn’t right either. Lower-level components typically don’t have the context to know whether a particular fault requires action or not. And since systems are complex, with many levels of abstractions and boxes things live in, actually not much is in a position to know this, even to a standard of “probably”.