且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Java中使用e.printStackTrace()

更新时间:2022-06-23 05:32:50

这只是一个建议.在eclipse中很好-我相信这只是IDE告诉您,还有其他一些更常规的方法可以做到这一点. 我发现它对于调试很有用,并且应该在发生致命错误时告诉用户使用调试模式(例如控制台开关-d)来收集这些日志.

It is just a recommendation. In eclipse it is fine - I believe it is just the IDE telling you that there are more conventional methods of doing it, like some of the other answers. I find that it is useful for debugging, and that you should tell users when a fatal error is going to occur, to use a debug mode (like a console switch -d) to collect these logs.