mybatis 打印sql语句配置

2016-12-30 09:52

在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