使用SuperDevMode打印堆栈跟踪是默认的

时间:2015-01-04 14:35:23

标签: java gwt

我有这个代码用GWT来处理未捕获的异常:

    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        @Override
        public void onUncaughtException(Throwable throwable) {
            // Iterate over the trace and then print with $wnd.console.log
            printStackTrace(throwable.getStackTrace());
        }
    });

但是,浏览器控制台中打印的日志如下所示:

"Unknown.Ol(Unknown Source)
Unknown.Nl(Unknown Source)
Unknown.Vl(Unknown Source)
Unknown.Hu(Unknown Source)
Unknown.Ku(Unknown Source)
Unknown.ju(Unknown Source)
Unknown.h6(Unknown Source)
Unknown.As(Unknown Source)
Unknown.j6(Unknown Source)
Unknown.u6(Unknown Source)
Unknown.L3(Unknown Source)
Unknown.k5(Unknown Source)
Unknown.hn(Unknown Source)
Unknown.mn(Unknown Source)
Unknown.ln/<(Unknown Source)
Unknown.anonymous(Unknown Source)

如何让这个显示实际的堆栈跟踪,就像旧的GWT样式一样?

1 个答案:

答案 0 :(得分:3)

这对我有用,请记住它并不完美,但它会在堆栈跟踪中提供文件和行号。是的,这适用于gwt 2.7和超级开发模式。您需要将其添加到* .gwt.xml文件中。您可能希望将其关闭以进行生产,因为它会增加相当多的代码膨胀,但会使调试变得更加简单。

<set-property name="compiler.stackMode" value="emulated" />
<set-configuration-property name="compiler.emulatedStack.recordFileNames"
value="true" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers"
value="true" />