001 : log4j 报错

        导入了commons-logging.jar和log4j-1.2.16.jar两个jar包之后,就想试试log4j的强大功能了。没想到一运行就报了错:

log4j:WARN No appenders could be found for logger (Log4jTest).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

        稍微一看,才发现想要运行log4j的话,先要写一个log4j.properties的配置文档。不然就会报上面的错误。

附报错代码:

import org.apache.log4j.Logger;


public class Log4jTest {

	private static Logger logger = Logger.getLogger(Log4jTest.class);
	
	public static void main(String[] args) {

		logger.debug("Hello, my name is zwj.");
	}

}

 

 

你可能感兴趣的:(apache,html,log4j)