Log.e 不打印 UnknownHostException 的堆栈跟踪

Log.e does not print the stack trace of UnknownHostException

调用 Log.e(TAG, "some message", e),其中 e 是一个 UnknownHostException,不会在 logcat 上打印堆栈跟踪。

自 2011 年 5 月 20 日起,Logclass 发生了变化,UnknownHostException 异常未打印。

This is to reduce the amount of log spew that apps do in the non-error condition of the network being unavailable. https://github.com/android/platform_frameworks_base/commit/dba50c7ed24e05ff349a94b8c4a6d9bb9050973b

您包含的 e 没有用,删除它,它会在 logcat 中可见。

Log.e(TAG, "some message");