简体   繁体   English

如何在Java(Eclipse,android)中使用printstacktrace?

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

I am developing an android app using eclipse. 我正在使用eclipse开发一个android应用程序。 How to see printstacktrace's output? 如何查看printstacktrace的输出?

printstacktrace's output can be seen in the DDMS ->Logcat view 可以在DDMS-> Logcat视图中看到printstacktrace的输出

Please use Log for printing Log's.The message types, and their related method calls are: 请使用Log来打印Log。消息类型及其相关方法调用为:

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 要查看日志输出,请转至DDMS> LogCat

In android development on eclipse, better use logcat. 在eclipse上进行android开发时,最好使用logcat。 In eclipse, go to Window/Show View/Other... and choose Logcat under Android from the dialog. 在Eclipse中,转到“窗口/显示视图/其他...”,然后从对话框中选择Android下的Logcat。

在Eclipse中打开Logcat

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. 您可以使用过滤器隐藏系统或其他应用程序中的消息。

In Android you should prefer Log class methods to the printStackTrace() . 在Android中,您应该首选Log类方法而不是printStackTrace() You can see Log output inside the logcat in the DDMS. 您可以在DDMS的logcat内部看到Log输出。 Hope this helps. 希望这可以帮助。

to see printstacktrace's output.. 查看printstacktrace的输出。

Use Log class methods.. like Log.i , Log.v etc.. 使用Log类方法..如Log.iLog.v等。

To see Log output go to DDMS > LogCat 要查看日志输出,请转至DDMS > LogCat

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM