gwt logging not working

2019-08-26 07:28发布

I am trying the GWT logging features.

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

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>

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

public void onModuleLoad() {


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

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

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

Why nothing shows up in the Java console?

标签: logging gwt
1条回答
你好瞎i
2楼-- · 2019-08-26 07:57

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.

查看更多
登录 后发表回答