开发者

Printing a logging message to the console in a GWTTestCase

I'd li开发者_如何学Cke to debug some of my GWTTestCase and printing logging messages would probably be the easiest way to do it. Is there any way to do that?


If you're running the test in DevMode (i.e. you didn't pass -web or -prod to the JUnitShell) you can use System.out.println() for some bare-bones logging.


Either use the standard GWT Logging mechanism as described here: http://code.google.com/webtoolkit/doc/latest/DevGuideLogging.html

That is an emulation of java.util.logging so you can call it on client, shared or server code and will all work.

Or, there is also the excellent gwt-log GWT library here: http://code.google.com/p/gwt-log/

Which is easy to add to your project.


Have you checked out http://code.google.com/webtoolkit/doc/latest/DevGuideLogging.html


private static Logger logger = Logger.getLogger("");
...
logger.log(Level.INFO, "Some stuff");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜