【问题标题】:Loggers in GWT Client SideGWT 客户端中的记录器
【发布时间】:2010-01-22 14:07:17
【问题描述】:

有没有办法在客户端 GWT 应用程序中报告日志消息以用于开发目的(在标准 GWT 库中,即没有外部库)?

即就像 Logger 在开发 Tomcat 时可用于将日志消息输出到 catalina.out。

【问题讨论】:

    标签: logging gwt


    【解决方案1】:

    查看 gwt-log 项目。看来这就是你要找的。​​p>

    http://code.google.com/p/gwt-log/

    【讨论】:

    【解决方案2】:

    只是一个简单的例子..

    在 *.gwt.xml 文件中添加这一行。它在您的客户端源的父包中。最顶级的包..

    <inherits name="com.google.gwt.logging.Logging"/>
    

    在 .java 文件中添加这个,比如说在 onModuleLoad() 方法中

    public void onModuleLoad() {
      Logger logger = Logger.getLogger("NameOfYourLogger");
        logger.log(Level.SEVERE, "this message should get logged");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-22
      • 2011-02-05
      • 1970-01-01
      • 2011-11-14
      • 1970-01-01
      相关资源
      最近更新 更多