该贴转自:http://www.javaeye.com/topic/378077
log4j是一个非常强大的log记录软件,下面我们就来看看在项目中如何使log4j。
首先当然是得到log4j的jar档,推荐使用1.2.X版,下载地址:
http://logging.apache.org/log4j/1.2/download.html
// 记录debug级别的信息 if (logger.isDebugEnabled()) { logger.debug("This is debug message from Dao."); } // 记录info级别的信息 if (logger.isInfoEnabled()) { logger.info("This is info message from Dao."); } // 记录error级别的信息 logger.error("This is error message from Dao.");
参考资料: