Eclipse的logcat的窗口切断异常堆栈跟踪堆栈、异常、窗口、Eclipse

2023-09-14 23:03:08 作者:缺情不缺钱

在Eclipse中我的logcat窗口只显示堆栈跟踪每个异常的前几行。这意味着,我经常看不到的地方异常发生。有没有办法改变这个设置?

My logcat window in Eclipse only displays the first few lines of the StackTrace for each exception. This means that I often can't see where an exception occured. Is there any way to change this setting?

推荐答案

如果你指的是...... 12多行......的一部分,你只能看到该是另一种异常的原因异常。如果栈跟踪的顶部部分是相同的较早跟踪,全组帧仅示出了最外面的异常,和其他痕迹得到的...治疗

If you're referring to the "...12 more lines..." part, you only see that for exceptions that were the cause of another exception. If the top part of the stack trace is the same as the earlier trace, the full set of frames is only shown for the outermost exception, and the other traces get the "..." treatment.

换句话说,未示出的迹线的块是一个跟踪先前在异常原因链出现的副本。例如,假设我有code,其中的方法的main()电话一(),要求两(),等等。 四()引发异常。 两()将其捕获并重新抛出它。异常会是这样的:

Put another way, the chunk of a trace that isn't shown is a duplicate of a trace that appeared earlier in the exception cause chain. For example, suppose I have code where the method main() calls one(), which calls two(), and so on. four() throws an exception. two() catches it and re-throws it. The exception will look like this:

java.lang.RuntimeException: re-throw
    at Foo.two(Foo.java:14)
    at Foo.one(Foo.java:7)
    at Foo.main(Foo.java:3)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: first
    at Foo.four(Foo.java:23)
    at Foo.three(Foo.java:19)
    at Foo.two(Foo.java:12)
    ... 3 more

在致异常说...... 3个,而不是明确列出一()的main() dalvik.system.NativeStart.main 。因此,要获得初始异常的全面跟踪,你会读它的踪影开始,然后继续在上面的痕迹。

The "caused by" exception says "... 3 more" rather than explicitly listing one(), main(), and dalvik.system.NativeStart.main. So to get the full trace of the initial exception, you would start by reading its trace, then continue at the trace above.

请注意有没有重叠 - 两()出现在这两个,但在第一次跟踪它是在调用三( ),并在再抛追踪它的抛出指令。

Note there is no overlap -- two() appears in both, but in the "first" trace it's on the call to three(), and in the "re-throw" trace it's on the throw instruction.

 
精彩推荐
图片推荐