通过Log4j.properties配置 ibatis 在控制台输出执行的sql


Log4j.properties加入如下代码 
  1. # Set root logger level to DEBUG and its only appender to CONSOLE.
  2. log4j.rootLogger=WARN,CONSOLE
  3. # CONSOLE
  4. log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
  5. log4j.appender.stdout=org.apache.log4j.ConsoleAppender
  6. log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
  7. log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m%n
  8. log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
  9. log4j.appender.CONSOLE.Threshold=INFO
  10. log4j.logger.com.ibatis=debug
  11. log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=debug
  12. log4j.logger.com.ibatis.common.jdbc.ScriptRunner=debug
  13. log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=debug
  14. log4j.logger.java.sql.Connection=debug
  15. log4j.logger.java.sql.Statement=debug
  16. log4j.logger.java.sql.PreparedStatement=debug,stdout

相关推荐