gwt日志记录不起作用 [英] gwt logging not working

查看:133
本文介绍了gwt日志记录不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试GWT日志记录功能.

I am trying the GWT logging features.

我用GWT 2.8.2创建了一个Gwt应用程序项目 该应用程序正常工作.

I have created a Gwt Application Project with GWT 2.8.2 The application works.

这是我的gwt.xml文件,其中已启用日志记录:

Here is my gwt.xml file with logging enabled:

<?xml version="1.0" encoding="UTF-8"?>
<!--
  When updating your version of GWT, you should also update this DTD reference,
  so that your app can take advantage of the latest GWT module capabilities.
-->
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.8.2//EN"
  "http://gwtproject.org/doctype/2.8.2/gwt-module.dtd">
<module rename-to='testtest'>
  <!-- Inherit the core Web Toolkit stuff.                        -->
  <inherits name='com.google.gwt.user.User'/>

  <!-- Inherit the default GWT style sheet.  You can change       -->
  <!-- the theme of your GWT application by uncommenting          -->
  <!-- any one of the following lines.                            -->
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>
  <!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
  <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->

  <!-- Other module inherits                                      -->

  <!-- Specify the app entry point class.                         -->
  <entry-point class='test.client.Testtest'/>

  <inherits name="com.google.gwt.logging.Logging"/>
 <set-property name="gwt.logging.enabled" value="TRUE"/> 
<set-property name="gwt.logging.logLevel" value="INFO" />
<!-- Write messages to browser consoles and to the jvm and dev mode -->
<!-- Note that these are the defaults, so we don’t actually need to list them -->
<set-property name="gwt.logging.consoleHandler" value="ENABLED" />

<set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />
<set-property name="gwt.logging.systemHandler" value="ENABLED" />

<set-property name="gwt.logging.enabled" value="TRUE" />


  <!-- Specify the paths for translatable code                    -->
  <source path='client'/>
  <source path='shared'/>

  <!-- allow Super Dev Mode -->
  <add-linker name="xsiframe"/>
</module>

在我的Java代码中,我已经输入了一条简单的消息.

In my Java code I've put a simple message.

public void onModuleLoad() {


        Logger logger = Logger.getLogger("test");
        logger.info("test");

但是,当我运行该应用程序时,Java控制台中没有显示任何内容(使用超级开发模式"或传统模式").

But when I run the application nothing shows up (either with Super Development Mode or Legacy Mode) in the Java console.

GWT.log可以在浏览器控制台中正常工作并记录消息.

GWT.log works and logs messages in the browser console.

为什么Java控制台中什么都没显示?

Why nothing shows up in the Java console?

推荐答案

日志被写入客户端的控制台.在浏览器中打开控制台(例如chrome中的F12).您应该在此处看到日志.

The log is written to the console on the client side. Open the console in your browser (e.g. F12 in chrome). You should see the log there.

这篇关于gwt日志记录不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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