Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • do not log an exception and then re-throw exactly the same exception
  • all exception stacktraces should be logged at some level
    • in cases where errors are returned to clients, never return a stack trace to the remote client, generic error messages that do not expose the inner workings of the system should be returned
  • be as specific as possible
    • include state information such as variable values, especially when there's a probable cause for an exception
  • if a logging message this is expensive to generate and it will only be logged at the debug or lower level, wrap the logging statement in anĀ if(LOGGER.isDebugEnabled()) block