How to print to the console in GWT

前端 未结 10 1123
广开言路
广开言路 2020-12-23 14:29

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. Do

10条回答
  •  醉话见心
    2020-12-23 15:04

    Quoting the documentation:

    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
    
    
    # In your .java file
    Logger logger = java.util.logging.Logger.getLogger("NameOfYourLogger");
    logger.log(Level.SEVERE, "this message should get logged");
    

提交回复
热议问题