Monday, May 14, 2012

Logger with BasicConfigurator.

Please follow the following program to implement log4j with BasicConfigurator and use the provided scenario's to use the specific logger methods.


import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;

public class BasicConfiguratorDemo {

      private static final Logger loggerLogger.getLogger(BasicConfiguratorDemo.class);

      public static void main(String[] args) {
            BasicConfigurator.configure();
            logger.trace("Trace Message.");
            logger.debug("Debug Message.");
            logger.info("Info Message.");
            logger.warn("Warning Message.");
            logger.error("Error Message.");
            logger.fatal("Fatal Error Message.");
      }
}

No comments:

Post a Comment