Tips for Proper Application Logging
- Use the appropriate tools for logging. SLF4J is the best logging API available, mostly because of a great pattern support.
- SLF4J provides logging levels for you.
- 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
- 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.
- DEBUG – Developers stuff. To keep the track of the flow of operation in the application.
Add Comment