gwt logging not working

こ雲淡風輕ζ 提交于 2020-04-18 02:34:13

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/50579095/gwt-logging-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!