Skip to end of metadata
Go to start of metadata

This page contains temporary result from dicussions on error handling.

These guidelines must be reviewed and approved before being promoted to the Error Handling page.

Best practices

  • Human readable logs : fields organized in aligned columns, standard date format
  • Redefine toSring() method : using Guava Objects.ToStringHelper for instance. It helps a lot to improve log readability.

Anti patterns

  • Multi-line log messages. Messages must be grouped in a single log.
  • Huge try-catch block complicates refactoring

    Found in sonar-php-plugin

Re-wrapping exceptions

Not correct propagation :

Better :

With Google Guava :

Logback advanced features

Integration tests

  • Regressions are frequently introduced on error handling. Integration tests must verify behaviors on error as much as possible. Most of time they need to access generated logs. See ORCH-66.
Labels
  • None