문제

When I run some java program with a command java ExceptionTest , exceptions are sometimes omitted and looks like

Exception in thread "main" java.lang.NoClassDefFoundError: aa/bb/DD
        at SOMEWHERE(unknown source)
Caused by: java.lang.ClassNotFoundException: aaa.bbb.CC
        at SOMEWHER(unknown source)
        ... 13 more

I'd like to see 13 more exceptions in this case. Is there an option to see all exception log?

도움이 되었습니까?

해결책

You already see them, it's only the ridiculous way Java (and Logback by defaul) prints exceptions by default. This stack trace:

Exception in thread "main" java.lang.NoClassDefFoundError: aa/bb/DD
        at SOMEWHERE(unknown source)
Caused by: java.lang.ClassNotFoundException: aaa.bbb.CC
        at SOMEWHER(unknown source)
        ... 13 more

actually means the following program flow (from bottom to top):

Caused by: java.lang.ClassNotFoundException: aaa.bbb.CC
        at SOMEWHER(unknown source)
Exception in thread "main" java.lang.NoClassDefFoundError: aa/bb/DD
        at SOMEWHERE(unknown source)

The ... 13 more (N common frames omitted in Logback) only means that these exceptions were already printed before. In Logback you can restructure stack track to avoid duplicates and print stack lines always in correct order, see my blog.

다른 팁

there aren't 13 more exceptions. There are 13 more lines to the call stack which are identical to previous call stacks, as described here: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Throwable.html#printStackTrace()

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top