Friday, August 12, 2011

How to log with GWT

In your test.gwt.xml file, you have to add the following :


 <inherits name="com.google.gwt.logging.Logging"/>
  <set-property name="gwt.logging.logLevel" value="INFO"/>          # To change the default logLevel
  <set-property name="gwt.logging.enabled" value="TRUE"/> 

In your java file :


  • Import the logger :

import java.util.logging.Logger;


  • Declare logger variable :

private static final Logger logger = Logger.getLogger(WeightManager.class.getName());


  • Call logger methods :

logger.info("========>TEST !!!!");

Note : Logging works only in client side (so in client package).In server side it doesn't work for me so if I found something, I will publish a post.

No comments:

Post a Comment