#将ibatis log4j Run level to debug you can print out Ibatis run SQL statements in the console
Log4j.rootlogger=debug,stdout,logfile
# # # to output log information to the console # # #
Log4j.appender.stdout=org.apache.log4j.consoleappender
#log4j. Appender.stdout.target=system.err
Log4j.appender.stdout.layout=org.apache.log4j.simplelayout
# # # to output log information to file: Jbit.log # # #
Log4j.appender.logfile=org.apache.log4j.fileappender
Log4j.appender.logfile.file=d:/test.log
Log4j.appender.logfile.layout=org.apache.log4j.patternlayout
Log4j.appender.logfile.layout.conversionpattern=%d{yyyy-mm-dd HH:mm:ss}%F%p%m%n
# # #显示SQL语句部分
Log4j.logger.com.ibatis=debug
Log4j.logger.com.ibatis.common.jdbc.simpledatasource=debug
Log4j.logger.com.ibatis.common.jdbc.scriptrunner=debug
Log4j.logger.com.ibatis.sqlmap.engine.impl.sqlmapclientdelegate=debug
Log4j.logger.java.sql.connection=debug
Log4j.logger.java.sql.statement=debug
Log4j.logger.java.sql.preparedstatement=debug
Or
1. First tune the Ibatis log4j runlevel to debug to print out the SQL statements Ibatis run on the console
2. Add the following statement
# # #显示SQL语句部分
Log4j.logger.com.ibatis=debug
Log4j.logger.com.ibatis.common.jdbc.simpledatasource=debug
Log4j.logger.com.ibatis.common.jdbc.scriptrunner=debug
Log4j.logger.com.ibatis.sqlmap.engine.impl.sqlmapclientdelegate=debug
Log4j.logger.java.sql.connection=debug
Log4j.logger.java.sql.statement=debug
Log4j.logger.java.sql.preparedstatement=debug
MyBatis and Ibatis console print SQL statement methods