如何在GWT中打印到控制台 [英] How to print to the console in GWT
问题描述
我正在调试一个GWT应用程序,我需要将一些内容打印到控制台以进行测试。 System.out.println
和 GWT.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?
推荐答案
引用文档:
Quoting the documentation:
添加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屋!