Versions Compared

Key

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

Tips for Proper Application Logging

  1. Use the appropriate tools for logging. SLF4J is the best logging API available, mostly because of a great pattern support.
  2. SLF4J provides logging levels for you.
    1. ERROR – something terribly wrong had happened, that must be investigated immediately. No system can tolerate items logged on this level. Example: NPE, database unavailable, mission critical use case cannot be continued
    2. WARN – the process might be continued, but take extra caution. Actually I always wanted to have two levels here: one for obvious problems where work-around exists (for example: “Current data unavailable, using cached values”) and second (name it: ATTENTION) for potential problems and suggestions.