Logging Levels

Most popular logging frameworks (e.g. Log4J, SLF4J, Log4Net, EntLib) allow for several logging levels to be instrumented. A common question is: What logging levels are appropriate under what scenarios? The following lists some common log levels are their usage:
  • Fatal -
    • Service/ application/ process about to terminate.
    • Unable to proceed with normal operation.
    • Force a shutdown to prevent (further) data loss.
    • Examples:
      • No more system resource (OOM)
  • Error -
    • Unhandled or unexpected system error has occurred.
    • Current operation/ thread to be aborted.
    • Issue needs to be fixed.
    • Still able to continue with normal operation (at least for other users/ sessions) otherwise.
    • Examples:
      • database deadlock
      • Unexpected/ unhandled exception
      • Runtime errors
      • Transaction aborted
      • Can't create file
  • Warn -
    • Things are generally working fine.
    • Recoverable conditions.
    • Transient environmental conditions happened.
    • Something happened (but was handled) that may potentially turn into error conditions soon but has yet to happen.
    • Examples:
      • number of connections getting low
      • operation timeout
      • CPU utilisation reaches 80%
      • data unavailable; using cached/ default values
  • Info -
    • Useful and important information for logging.
    • No cause for concern.
    • A normal & expected event happened.
    • Useful in the running and management of the system.
    • Examples:
      • Successful initialisation
      • Starting/ stopping of services
      • Successful transactions
  • Debug -
    • Useful in troubleshooting in production environment but otherwise, should only be used in development and testing environments.
    • Used by IT professionals (e.g. developers, system admins, etc.).
  • Trace -
    • Detailed tracing and logging.
    • Specifically for developers only.

Comments

Popular posts from this blog

Understanding ITIL Service Management the UML way…

Apache Web Server Troubleshooting