首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >不生成gwt日志

不生成gwt日志
EN

Stack Overflow用户
提问于 2012-06-22 14:46:02
回答 1查看 1.1K关注 0票数 1

使用gwt logs jar,我可以在控制台上显示日志。但是现在我想在我的olgs文件中添加日志,就像我们在服务器端使用log4j一样。所以我向http://code.google.com/p/gwt-log/wiki/GettingStarted推荐了这个链接,但我没有看到任何客户端日志在我的日志文件中生成。

以下是我的gwt.xml文件

代码语言:javascript
复制
<inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />
<set-property name="log_DivLogger" value="DISABLED" />
<!-- In gwt-log-3.0.3 or later -->
<inherits name="com.allen_sauer.gwt.log.gwt-log-RemoteLogger" />
<set-configuration-property name="log_pattern" value="%d [%t] %p - %m
   %n" />

以下是我的web.xml文件

代码语言:javascript
复制
<servlet>
<servlet-name>gwt-log-remote-logger-servlet</servlet-name>
<servlet-class>com.allen_sauer.gwt.log.server.RemoteLoggerServiceImpl</servlet-class>
<!--
   The `symbolMaps` parameter specifies the server directory
    containing the GWT compiler symbol maps output, which is used
     for stack trace deobfuscation
    -->
  <init-param>
       <!-- This value assumes a GWT compile with '-deploy war/WEB-INF/deploy/' -->
      <param-name>symbolMaps</param-name>
       <!--
     Modify the param-value based on your server environment. Some web servers
    use your `war` directory as the 'current working dir', while other
    vendors will do something different. You may use trial and error. Specify the
    relative path you think should work, then check the server log after forwarding
    the first client log message to the server. If the directory cannot be found,
    gwt-log will report the full path which it tried.
  -->
  <param-value>WEB-INF/deploy/detectfiles/symbolMaps/</param-value>
  </init-param>

  <!--
    Additional or alternate directories may be specified via additional parameter
  which also begin with `symbolMaps`. This may be useful if you deploy to multiple
  server environments which use different directory structures or have a different
  notion of what the 'current working directory' is.
 --> 
 <init-param>
   <param-name>symbolMaps_2</param-name>
   <param-value>WEB-INF/deploy/detectfiles/symbolMaps/</param-value>
 </init-param>

     <!-- Optionally enable CORS (http://www.w3.org/TR/cors/)
  <init-param>
     <param-name>Access-Control-Allow-Origin</param-name>
     <param-value>http://your-applications-origin</param-value>
  </init-param> 
  -->
</servlet>

<servlet-mapping>
    <servlet-name>gwt-log-remote-logger-servlet</servlet-name>
  <url-pattern>/com.renault.detectfiles/gwt-log</url-pattern>
  </servlet-mapping>

我已经在客户端添加了日志,如下所示

代码语言:javascript
复制
        Log.debug("Hi this is a debug log");
EN

回答 1

Stack Overflow用户

发布于 2012-06-22 18:11:01

首先,确保使用附加参数GWT /WEB-INF/deploy/编译-deploy应用程序。

其次,确保WEB-INF/deploy/detectfiles/symbolMaps/目录中存在符号映射。当我编译时,我观察到symbolMaps转到目录WEB-INF/deploy/<module-name>/symbolMaps/。在这里,detectfiles看起来不像您的模块名称。因为在url-pattern中,您已经指定com.renault.detectfiles作为模块名称。

这些可能是看不到日志的原因。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11151355

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档