e.printStackTrace() 工作正常(即将我的堆栈跟踪打印到标准错误)但 Log.X 根本无法打印堆栈跟踪。
例如:
} catch (IOException e) {
Log.e("Network", "Exception", e);
e.printStackTrace();
}
输出:
08-31 03:46:21.992: W/Network(13238): Exception
08-31 03:46:22.092: W/System.err(13238): java.net.UnknownHostException: Unable to resolve host "...": No address associated with hostname
08-31 03:46:22.204: W/System.err(13238): at java.net.InetAddress.lookupHostByName(InetAddress.java:394)
08-31 03:46:22.222: W/System.err(13238): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
08-31 03:46:22.222: W/System.err(13238): at java.net.InetAddress.getAllByName(InetAddress.java:214)