1. 导入如上 log下的对应jar包html
2. 在src下新建log4j.properties文件,类容如(详细配置:http://www.cnblogs.com/suman/archive/2010/10/23/1858864.html )apache
3.编写代码this
import org.apache.commons.logging.Log; url
import org.apache.commons.logging.LogFactory;htm
Log log = LogFactory.getLog( this .getClass()); blog
四、附件为参考例子get