这是个坏主意,在Android中使用异常的printStackTrace()?坏主意、这是个、异常、Android

2023-09-05 10:04:39 作者:孤岛少女情

这是个坏主意,在Android的例外是这样使用的printStackTrace()?

 }赶上(例外五){
    e.printStackTrace();
}
 

解决方案

是的,这是一个坏主意。你应该使用Android的内置专为这些目的而设计的日志类:http://developer.android.com/reference/android/util/Log.html

它给你的选项来记录调试消息,警告,错误等。

Is it a bad idea to use printStackTrace() in Android Exceptions like this?

} catch (Exception e) {
    e.printStackTrace();
}
在简历里使用bitmoji或许是这世界上最糟糕的主意

解决方案

Yes, it is a bad idea. You should instead use Android's built-in log class specifically designed for these purposes: http://developer.android.com/reference/android/util/Log.html

It gives you options to log debug messages, warnings, errors etc.