
import org.apache.log4j.*;

public class TestLog4J {
static Logger log = Logger.getLogger(TestLog4J.class.getName());

public static void main(String args[]) {
BasicConfigurator.configure();
// logging的各种方法
log.debug("Start of main()");
log.info("Just testing a log message with priority set to INFO");
log.warn("Just testing a log message with priority set to WARN");
log.error("Just testing a log message with priority set to ERROR");
log.fatal("Just testing a log message with priority set to FATAL");
// 另一种不方便的格式
log.log(Priority.DEBUG, "Testing a log message use a alternate form");
log.debug("End of main().");
}
}
