akka/akka-core

Better Error Logging

開放

#16,745 建立於 2015年1月28日

 (7 則留言) (0 個反應) (0 位負責人)Scala (3,547 個分叉)batch import
1 - triagedhelp wantedt:core

倉庫指標

星標
 (13,277 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南