GWT:将客户端错误/堆栈跟踪发送到服务器? [英] GWT: Send client-side errors/stack traces to server?

查看:238
本文介绍了GWT:将客户端错误/堆栈跟踪发送到服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此前必须先询问,但我没有任何搜索。我正在寻找一种方法来捕获所有客户端模糊的错误/堆栈跟踪,并将它们发送到服务器进行调试。我使用window.onerror看到了一些关于javascript的内容,但是我正在寻找一种方法来使用GWT,然后显示一个非混淆的堆栈跟踪。



任何人都知道如何做到这一点?谢谢!



编辑:
在工作了几个小时后,我将从GWT转到日志服务器通过:

  GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler(){
@Override
public void onUncaughtException(Throwable e){
log.log(Level.SEVERE,e.getMessage(),e);
}
});

现在使用gwt包含的默认Logger。这是相关的.gwt.xml:

 < inherits name =com.google.gwt.logging.Logging/ > 
< set-property name =gwt.logging.logLevelvalue =WARNING/>
< set-property name =gwt.logging.enabledvalue =TRUE/>
< set-property name =gwt.logging.simpleRemoteHandlervalue =ENABLED/>
< set-property name =gwt.logging.consoleHandlervalue =DISABLED/>
< set-property name =gwt.logging.developmentModeHandlervalue =ENABLED/>
< set-property name =gwt.logging.systemHandlervalue =ENABLED/>
< set-property name =gwt.logging.popupHandlervalue =DISABLED/>
< set-property name =gwt.logging.firebugHandlervalue =DISABLED/>
< set-configuration-property name =compiler.emulatedStack.recordLineNumbersvalue =true/>
< set-configuration-property name =compiler.emulatedStack.recordFileNamesvalue =true/>

我在网上搜索,甚至发现这是gwt-log,这似乎是它已经实现到GWT SDK中: http://code.google.com/p/ gwt-log / wiki / GettingStarted#Override_the_default_URL_which_the_RemoteLogger_connects_to



我按照上述链接的指示,更新包名称以及没有。我现在用以下参数进行编译:-deploy war / WEB-INF / deploy /



这是我的web.xml的相关部分:

 <! -  Servlets  - > 
< servlet>
< servlet-name> RemoteLoggerServlet< / servlet-name>
< servlet-class> com.google.gwt.logging.server.RemoteLoggingServiceImpl< / servlet-class>
< init-param>
< param-name> symbolMaps< / param-name>
< param-value> WEB-INF / deploy / ** MYAPPNAMEHERE ** / symbolMaps /< / param-value>
< / init-param>
< / servlet>

< servlet-mapping>
< servlet-name> RemoteLoggerServlet< / servlet-name>
< url-pattern> / ** MYAPPNAMEHERE ** / remote_logging< / url-pattern>
< / servlet-mapping>

最终的结果是我得到错误,他们只是没有去混淆。我做错了什么?

解决方案

initParam code> RequestFactoryServlet 。使用 RemoteLoggingServiceImpl ,您应该调用其 setSymbolMapsDirectory 方法;通常通过对servlet进行子类化并从构造函数或 init 方法调用该方法。


This has to have been asked before, but I haven't had any in searches. I'm looking for a way to catch all client-side obfuscated errors/stack traces and send them to the server for debugging. I did see something about this for javascript using the window.onerror, but I'm looking for a way to do this with GWT, and then display a non-obfuscated stack trace.

Anyone know how to do this? Thanks!

Edit: After working on this for several more hours, I've got the logs going over from GWT to the server via:

    GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {
        @Override 
        public void onUncaughtException(Throwable e) {
            log.log(Level.SEVERE, e.getMessage(), e);
        }
    });

That is using the default Logger included with gwt now. this is the relevent .gwt.xml :

<inherits name="com.google.gwt.logging.Logging" />
<set-property name="gwt.logging.logLevel" value="WARNING" />
<set-property name="gwt.logging.enabled" value="TRUE" />
<set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" />
<set-property name="gwt.logging.consoleHandler" value="DISABLED" />
<set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />  
<set-property name="gwt.logging.systemHandler" value="ENABLED" />
<set-property name="gwt.logging.popupHandler" value="DISABLED" />
<set-property name="gwt.logging.firebugHandler" value="DISABLED" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true"/>
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true"/>

I searched everywhere online, and I even found this which is something from gwt-log, which seems like it's before it was implemented into the GWT SDK: http://code.google.com/p/gwt-log/wiki/GettingStarted#Override_the_default_URL_which_the_RemoteLogger_connects_to

I followed the instructions from the above link, updating the package names and what not. I compile now with the following argument: -deploy war/WEB-INF/deploy/

and this is the relevant part of my web.xml:

<!-- Servlets -->
<servlet>
    <servlet-name>RemoteLoggerServlet</servlet-name>
    <servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>
    <init-param>
        <param-name>symbolMaps</param-name>
        <param-value>WEB-INF/deploy/**MYAPPNAMEHERE**/symbolMaps/</param-value>
    </init-param>
</servlet>

<servlet-mapping>
    <servlet-name>RemoteLoggerServlet</servlet-name>
    <url-pattern>/**MYAPPNAMEHERE**/remote_logging</url-pattern>
</servlet-mapping>

The end result is that I get the errors, they are just not de-obfuscated. What am I doing wrong?

解决方案

The initParam is for the RequestFactoryServlet. With the RemoteLoggingServiceImpl you're supposed to call its setSymbolMapsDirectory method; generally by subclassing the servlet and calling the method from the constructor or init method.

这篇关于GWT:将客户端错误/堆栈跟踪发送到服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆