Severity Usage |
Logahawk provides more
Severity levels than
most Logging frameworks. So what is the best way to use these
different levels?
- Debug - Used by developers to
create log statements for developers. Debug statements are usually
used in two ways: used often to allow a clear view into what the
system is doing at any point, or used only when a developer needs
to communicate something to another developer.
- Info - The most common
Severity level. This should be used to record any interesting
event that occurs.
- Alert - Used to record
interesting events that are more significant than Info statements
but do not indicate any sort of problem. This can be used to
log make statements standout from the sea of Info statements.
Long running applications are more likely to make use of this
Severity.
- Warn - Used to warn of
unexpected but recoverable or inconsisquential behavior. The
decision of whether something is a warning or error depends on
how it affects the operation in question.
- Error - Used record
errors, such as Exceptions. Depending on the application this
can be used for errors that halt the entire application or errors
in a particular operation that the application is managing. See
the description of Fatal and Panic.
- Fatal - Indicates that
an operation failed entirely or the application itself failed.
This should be used for errors more significant than Error. See
the description of Panic.
- Panic - Indicates an
unrecoverable error, one that prevents the application from
functioning. This should be used when the application must
shutdown. This Severity is based in the idea of the
panic()
function in UNIX.
|
Start and Finish |
A good opportunity to log is at the beginning and end of significant
operations. This includes program start and finish.
For server applications that control many sub-operations, either use
Alerts to indicate the start and stop of operations, use custom
LogMeta's to
tag log statements for each operation, or use separate log files.
(Custom
LoggerRegistry
can help create dynamic Loggers for each operation.)
|