About log4j-gwt

log4j-gwt enables GWT client applications to use the log4j framework. It provides a translatable implementation of the classes used for logging.

The output is forwarded to the normal GWT logging facility. So log4j-gwt supports the appenders and configuration provided by GWT.

It provides the Logger features of log4j. Most notable are:

How to use log4j-gwt?

In order to use log4j on the client side of a GWT application, you need to:

log4j-gwt makes use of the normal GWT logging configuration. log4j-gwt supports the GWT appenders including the widget appender (see screenshot) and the Firebug appender.

import org.apache.log4j.Logger;
import org.apache.log4j.MDC;
import org.apache.log4j.NDC;

public class Demogwt implements EntryPoint {
    private static Logger logger = Logger.getLogger(Demogwt.class);

    public void onModuleLoad() {

        // Simple messages
        logger.trace("A message at trace level.");
        logger.debug("A message at debug level.");
        logger.info("A message at info level.");
        logger.warn("A message at warn level.");

        // Logging exceptions
        try {
        } catch (NumberFormatException e) {
            logger.error("Parsing the number failed", e);

        // nested diagnostic context
        logger.info("Test for the NDC.");

        // mapped diagnostic context
        MDC.put("key1", "value1");
        MDC.put("key2", "value2");
        logger.info("Test for the MDC.");

Change log