代码之家  ›  专栏  ›  技术社区  ›  Gyonder

GWT日志记录不工作

  •  0
  • Gyonder  · 技术社区  · 7 年前

    我正在尝试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控制台中?

    1 回复  |  直到 7 年前
        1
  •  2
  •   Christian    7 年前

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