[logs] ugliest application logs ever?
Mordechai T. Abzug
morty at frakir.org
Mon Jan 28 19:06:27 PST 2008
On Thu, Jan 24, 2008 at 12:23:06AM -0500, Marcus J. Ranum wrote:
> "The Microsoft Exchange Information Store service depends on
> the Microsoft Exchange Directory service which failed to
> start because of the following error:
> The operation completed successfully."
I see this kind of thing a *lot*, on multiple platforms.
I suspect this happens because someone wrote a generic error handling
routine that includes the value of some global error function such as
strerror(errno). Sounds clever, but what if you call that function
for an error discovered logically instead of a system error? The
global errno contains success (since your last system function was
successful), so strerror(errno) contains "Success" or "Operation
Completed Successfully" or whatever.
The solution: when writing a generic error handing routine, understand
this issue and deal with it. One way to deal: write a routine that
displays a user-provided message, and *optionally*, also displays the
value of strerror(errno) (or language-specific equivalent.) In the
case where the caller specifies that a system error has occurred but
errno indicates success, the function should ignore the caller's
request, or display a suitable message ("unknown error", "generic
error", etc.) rather than the default success message. If the caller
does not specify a system error has occurred, even if errno indicates
failure, the routine should not automatically display strerror(errno),
because the last system call may have failed in a way that was
handled, and this log message may be a logical message unrelated to
the failure of the last system call.
IMHO, this should be in a FAQ somewhere. :)
- Morty
More information about the LogAnalysis
mailing list