How to print to the console in GWT

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
<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");

I needed to do this in the context of a GWT application that was deployed to an Android device/emulator via PhoneGap (and gwt-phonegap). Neither System.out.println() nor GWT logging as above (with module declaration) showed up in Android's logcat, so I resorted to a simple JSNI wrapper to console.log:

  public void onModuleLoad()
  {
    Logger logger = Logger.getLogger("Test1.java");
    logger.log(Level.INFO, "ash: starting onModuleLoad (1)"); // not in logcat
    System.out.println( "ash: starting onModuleLoad (2)" ); // not in logcat
    consoleLog( "ash: starting onModuleLoad (3)" ); // This shows up
    ...
  }

  native void consoleLog( String message) /*-{
      console.log( "me:" + message );
  }-*/;