如何在 GWT 中打印到控制台 [英] How to print to the console in GWT

查看:24
本文介绍了如何在 GWT 中打印到控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试 GWT 应用程序,我需要将一些内容打印到控制台以进行测试.System.out.printlnGWT.log 不起作用.有人有什么想法吗?

I am debugging a GWT application and I need to print some stuff to the console for testing purposes. System.out.println and GWT.log don't work. Does anyone have any ideas?

推荐答案

引用文档:

添加 GWT 日志真的很简单,就像下面的代码示例一样简单.然而——了解日志记录的工作原理,以及如何正确配置它很重要,所以请花点时间阅读本文档的其余部分.

Adding GWT logging is really quite simple, as simple as the following code example. However — understanding how logging works, and how to correctly configure it is important, so please do take the time to read the rest of this document.

http://code.google.com/webtoolkit/doc/latest/DevGuideLogging.html

启用日志记录的最简单方法是:

The simplest way to enable logging is:

# In your .gwt.xml file
<inherits name="com.google.gwt.logging.Logging"/>

# In your .java file
Logger logger = java.util.logging.Logger.getLogger("NameOfYourLogger");
logger.log(Level.SEVERE, "this message should get logged");

这篇关于如何在 GWT 中打印到控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆