简体   繁体   English

gwt-log日志消息在哪里?

[英]where are gwt-log log messages?

I'm trying to use gwt-log on my gwt application but I can't get any log message from this library( I don't know where should I found them) I have added these configuration to my gwt.xml file 我正在尝试在我的gwt应用程序上使用gwt-log,但无法从该库中获取任何日志消息(我不知道应该在哪里找到它们)我已将这些配置添加到我的gwt.xml文件中

  <inherits name="com.allen_sauer.gwt.log.gwt-log-DEBUG" />

  <extend-property name="log_level" values="DEBUG"/>

  <set-property name="log_level" value="DEBUG"/>
  <set-property name="log_DivLogger" value="DISABLED" />

and I have modified my entry point class as follows: 并且我修改了我的入口点类,如下所示:

 public void onModuleLoad() {
        Log.setUncaughtExceptionHandler();

        DeferredCommand.addCommand(new Command() {
            public void execute() {
                onModuleLoad2();
            }
        });
    }

        private void onModuleLoad2() {
         if (!Log.isLoggingEnabled()) {
              Window.alert("Logging is disabled. No log messages will appears.");
            }

                Log.trace("This is a 'TRACE' test message");
            Log.debug("This is a 'DEBUG' test message");
            Log.info("This is a 'INFO' test message");
            Log.warn("This is a 'WARN' test message");
            Log.error("This is a 'ERROR' test message");
            Log.fatal("This is a 'FATAL' test message");
            }

and I can get these messages printed on console but the problem is that I can't get any other message printed either in server side or in client side,So is there something I'm missing? 我可以在控制台上打印这些消息,但是问题是我无法在服务器端或客户端打印任何其他消息,所以我缺少什么吗?

Thanks 谢谢

You should be able to see them in the development console (Jetty container wrap), in hosted mode. 您应该能够在托管模式下的开发控制台(Jetty容器包装)中看到它们。 You can find a log of all HTTP traffic + gwt logs for a specific "host". 您可以找到特定“主机”的所有HTTP流量+ gwt日志的日志。

I'm not exactly sure how you can forward them to write to an external destination for production mode, though you should be able. 我不确定如何将它们转发以写入生产模式的外部目标,尽管您应该能够。

Make sure you setup the required servlet in web.xml. 确保在web.xml中设置所需的servlet

As a side note, if you are using GWT 2.1 or higher, you can start using the new Logging framework, which emulates Java's built-in logging framework. 附带说明一下,如果您使用的是GWT 2.1或更高版本,则可以开始使用新的Logging框架,该框架模仿Java的内置日志记录框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM