Saturday, January 26, 2013

Java GWT log4j client logging

Right now I googled a little bit to find out how enable log4j logging on client side.
Out there is lib which supports this named log4j-gwt.
In order to use log4j on the client side of a GWT application, you need to:
    1. add log4j-gwt.jar to the classpath right next to log4j.jar. Usually this is done by copying it to war/WEB-INF/lib
    2. add the following line to your module.gwt.xml file:
 
Just use it in your client site code like normal log4j.
private static Logger logger = Logger.getLogger(MyClass.class);

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. add the following line to your module.gwt.xml file:

    "<" inherits name="org.apache.log4j.Log4j" "/" ">"

    with the appropriate paranthesis

    ReplyDelete