问题
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