栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

Tomcat为什么无法显示实际的堆栈跟踪?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Tomcat为什么无法显示实际的堆栈跟踪?

在GWT文档中查找所有信息有点困难,您需要设置这些信息以进行模糊处理日志记录,因此以下是简短版本:

在您的模块文件(.gwt.xml)中,添加:

<inherits name="com.google.gwt.logging.Logging"/><set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" /><set-property name="compiler.stackMode" value="emulated" /><set-configuration-property name="compiler.emulatedStack.recordLineNumbers"      value="true" />

在客户端,使用类似

import java.util.logging.Logger;private static Logger rootLogger = Logger.getLogger("");...rootLogger.log(Level.SEVERE, "My message", e);

您无需

RemoteLoggingServiceAsync
在客户端上创建实例-记录器会自动使用该实例,因为我们指定了
<set-propertyname="gwt.logging.simpleRemoteHandler" value="ENABLED" />

在服务器端,配置RemoteLoggingServiceImpl。您将不得不告诉它,它在哪里找到symbolMaps,它将在使用GWT编译器参数进行编译时生成

-extra/path/to/myExtraDir
。我个人使用的方法来覆盖RemoteLoggingServiceImpl,允许从指定的web.xml的目录
<init-param>
小号[*]

package mypackage.server;public class ConfigurableRemoteLoggingServiceImpl extends RemoteLoggingServiceImpl {  @Override  public void init(final ServletConfig config) throws ServletException {    super.init(config);    final String symbolMapsDirectory =         config.getInitParameter("symbolMapsDirectory");    setSymbolMapsDirectory(symbolMapsDirectory);  }}

在中

web.xml
,像注册

<servlet>    <servlet-name>remoteLogging</servlet-name>    <servlet-class>mypackage.server.ConfigurableRemoteLoggingServiceImpl</servlet-class>  <init-param>    <param-name>symbolMapsDirectory</param-name>    <param-value>/path/to/myExtraDir/mymodulename/symbolMaps</param-value>  </init-param></servlet><servlet-mapping>    <servlet-name>remoteLogging</servlet-name>    <url-pattern>/mymodulename/remote_logging</url-pattern></servlet-mapping>

替换

/path/to/myExtraDir
mymodulename
mypackage
用自己的价值观,不要忘记调用与GWT编译器
-extra
参数(请注意,您不必使用
-stylePRETTY
或详细,它也与OBF的作品)。保留所有生成的symbolMap:如果没有它们,消除混淆将不起作用。由于每个新版本都会自动获得唯一的名称,因此您在构建时可以将它们全部收集在安全的中央位置。

[*]我真的,真的很奇怪,为什么RemoteLoggingServiceImpl本身没有实现!



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/422060.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号