package
log4jtest;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
import org.apache.log4j.BasicConfigurator;
public class log4jtest1 {
public log4jtest1() {
}
public static void main(String[] args) {
log4jtest1 log4jtest1 = new log4jtest1();
//1.create a logger
Logger loggerIns = Logger.getLogger(log4jtest1.class);
//2.use the default confirguation
BasicConfigurator.configure();
//3.set the logger level to info
loggerIns.setLevel(Level.INFO);
//4.This request will be disabled since Level.DEBUG < Level.INFO.
loggerIns.debug("this is a debug");
//5.these requests will be eabled
loggerIns.info("this is a info");
loggerIns.warn("this is a warn");
loggerIns.debug("this is a error");
loggerIns.fatal("this is a fatal");
return ;
}
}
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
import org.apache.log4j.BasicConfigurator;
public class log4jtest1 {
public log4jtest1() {
}
public static void main(String[] args) {
log4jtest1 log4jtest1 = new log4jtest1();
//1.create a logger
Logger loggerIns = Logger.getLogger(log4jtest1.class);
//2.use the default confirguation
BasicConfigurator.configure();
//3.set the logger level to info
loggerIns.setLevel(Level.INFO);
//4.This request will be disabled since Level.DEBUG < Level.INFO.
loggerIns.debug("this is a debug");
//5.these requests will be eabled
loggerIns.info("this is a info");
loggerIns.warn("this is a warn");
loggerIns.debug("this is a error");
loggerIns.fatal("this is a fatal");
return ;
}
}