1 package com.iqjava.log4j; 2 3 import org.apache.log4j.Logger; 4 import org.apache.log4j.PropertyConfigurator; 5 6 public class ExampleLog4j { 7 8 9 static final Logger logger = Logger.getLogger(ExampleLog4j.class); 10 11 public static void main(String[] args) { 12 13 PropertyConfigurator.configure("log4j.properties"); 14 logger.debug("Here goes the debug message"); 15 logger.error("Here goes the error message"); 16 logger.fatal("Here goes the fatal message"); 17 logger.info("Here goes the info message"); 18 logger.warn("Here goes the warn message"); 19 } 20 } 21