twitter/finagle — pull request #180 by jdanbrown (2013-06-20 19:17:39+00:00)
Title: ChannelSnooper: Print exceptions via Logger

We like using `ChannelSnooper` with a logging printer (e.g. via `{ServerBuilder,ClientBuilder}.logger`) and suppressing it by default in our logging config (logback via JUL) by setting the logger's level to `warn`. Then when we encounter problems to diagnose we can toggle `warn` to `info` and back. One annoyance with this approach is that when we suppress the `ChannelSnooper` logging [it still prints exception stacktraces to stdout](https://github.com/jdanbrown/finagle/blob/1744ce2e1aaab363b5c6df9a2a22b2e64c3f19e7/finagle-core/src/main/scala/com/twitter/finagle/netty3/ChannelSnooper.scala#L79) and, further, they don't include any indication of who's printing them.

This change delegates the exception printing to the printer, e.g., a logger that might choose to suppress it, and it also includes the message `"Snooped exception"` to give the end user something to grep for in the code to find out what's going on.