一、需要mybatis和log4j的jar;
二、然后在log4j.properties文件里面将下面的代码粘贴进去就可以了:
版本一:
<span style="font-size:12px;">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.java.sql.ResultSet=INFO log4j.logger.org.apache=INFO log4j.logger.java.sql.Connection=DEBUG log4j.logger.java.sql.Statement=DEBUG log4j.logger.java.sql.PreparedStatement=DEBUG</span>版本二:
<span style="font-size:12px;">log4j.rootLogger = ${log.level},Console,default,allfile log4j.logger.com.ibatis=debug log4j.logger.java.sql=debug log4j.logger.com.sf.egmas.dcn.web.mapper=debug</span>
版本三:
<span style="font-size:12px;">log4j.rootLogger=info,debug,stdout,info,error #ibatis logger config 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</span>