Java中log4j使用
Log4j的使用情况:
1.web项目 该种情况需要在web.xml中进行配置加载log4j
2.应用程序 如果运行的是class则需要使用PropertyConfigurator进行加载log4j
public class Main {
private static Log log = LogFactory.getLog(Main.class);
public static void main(String[] args) {
System.out.println("start");
PropertyConfigurator.configure("./src/log4j.properties");
log.debug("sas"); log.info("sasas");
System.out.println("end"); }
}