How to use printstacktrace in Java( Eclipse, android)?

白昼怎懂夜的黑 提交于 2019-12-10 10:59:29

问题


I am developing an android app using eclipse. How to see printstacktrace's output?


回答1:


printstacktrace's output can be seen in the DDMS ->Logcat view

Please use Log for printing Log's.The message types, and their related method calls are:

The Log.e() method is used to log errors.

The Log.w() method is used to log warnings.

The Log.i() method is used to log informational messages.

The Log.d() method is used to log debug messages.

The Log.v() method is used to log verbose messages.

The Log.wtf() method is used to log terrible failures that should never happen. (“WTF” stands for “What a Terrible Failure!” of course.)

To see Log output go to DDMS > LogCat




回答2:


In android development on eclipse, better use logcat. In eclipse, go to Window/Show View/Other... and choose Logcat under Android from the dialog.

When you start your app in debug mode, all messages will be logged there. You can use filters to hide messages from system or other apps.




回答3:


In Android you should prefer Log class methods to the printStackTrace(). You can see Log output inside the logcat in the DDMS. Hope this helps.



来源:https://stackoverflow.com/questions/15448490/how-to-use-printstacktrace-in-java-eclipse-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!