导入了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的配置文档。不然就会报上面的错误。
附简单的代码: