akka/akka-core

Better Error Logging

Open

#16.745 aberto em 28 de jan. de 2015

Ver no GitHub
 (7 comments) (0 reactions) (0 assignees)Scala (3.547 forks)batch import
1 - triagedhelp wantedt:core

Métricas do repositório

Stars
 (13.277 stars)
Métricas de merge de PR
 (Mesclagem média 17h 35m) (11 fundiu PRs em 30d)

Description

When exceptions occur, getting a useful error message to log is something of an art form rather than simplicity. Getting useful messages logged is very important in highly asynchronous systems such as Akka because often debuggers will simply avoid the (timing related) bug -- the infamous heisenbug. This issue suggests that Akka ought to have a general mechanism for extracting the appropriate error message from an exception.

Here are some examples of the issues we have with generating useful log messages from exceptions:

  • The getMessage method in some exceptions yields a null value (e.g. NullPointerException)
  • The getMessage method in some exceptions yields empty string (e.g. SocketTimeOutException)
  • The cause object is not used but some other object is instead (e.g. InvocationTargetException)
  • The message is unintelligible without the exception class name (e.g. NullPointerException)
  • The message is delegated to the cause but the cause is null so the message is null (IllegalArgumentException)
  • etc.

To help Akka provide helpful log messages, I am soliciting feedback from Akka developers about this issue, specifically:

  • Annoyances you've had tracking a bug that was made harder because of poor log messages from exceptions.
  • Ideas you have about how to, and how not to, implement a general mechanism to address this.
  • Ways to do this with least impact to the code (e.g. implement it in akka logging)
  • Specific exceptions you know are problematic.

The motivation for this came from this PR: https://github.com/akka/akka/pull/16725

Guia do colaborador