方案一:配置log4j

  1. log4j.logger.com.ibatis=DEBUG
  2. log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
  3. log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
  4. log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
  5. log4j.logger.Java.sql.Connection=DEBUG
  6. log4j.logger.java.sql.Statement=DEBUG
  7. log4j.logger.java.sql.PreparedStatement=DEBUG

方案二:MybatisConfig.xml配置

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE configuration
  3. PUBLIC "-//mybatis.org//DTD SQL Map Config 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-config.dtd">
  5. <configuration>
  6. <settings>
  7. <setting name="logImpl" value="STDOUT_LOGGING" />
  8. </settings>
  9. </configuration>

方案三:针对Springboot

修改application.yml

  1. mybatis:
  2. configuration:
  3. log-impl: org.apache.ibatis.logging.stdout.StdOutImpl