gwt 日志记录不工作

gwt logging not working

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

我已经使用 GWT 2.8.2 创建了一个 Gwt 应用程序项目 该应用程序有效。

这是我的 gwt.xml 启用了日志记录的文件:

<?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 代码中,我放了一条简单的消息。

public void onModuleLoad() {


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

但是当我 运行 应用程序在 Java 控制台中没有任何显示(无论是超级开发模式还是传统模式)。

GWT.log 工作并在浏览器控制台中记录消息。

为什么 Java 控制台中没有显示任何内容?

日志写入客户端的控制台。在浏览器中打开控制台(例如 chrome 中的 F12)。你应该在那里看到日志。