1. 程式人生 > >mybatis 列印sql語句配置

mybatis 列印sql語句配置

在classpath路徑下配置log4j.properties如下

log4j.rootLogger=DEBUG,Console

#Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
log4j.logger.org.apache=INFO


log4j.logger.com.ibatis = ERROR 
log4j.logger.com.ibatis.common.jdbc.SimpleDataSource = ERROR 
log4j.logger.com.ibatis.common.jdbc.ScriptRunner = ERROR 
log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate = ERROR


log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG 
log4j.logger.java.sql.ResultSet=DEBUG