一、 mybatis自带的settings

<settings>  
       <setting name="logImpl" value="STDOUT_LOGGING" />  
  </settings>

只需要在mybatis-config.xmi中加入这句话即可;(configuration下的标签有顺序,否则会报错:properties?, settings?, typeAliases?, typeHandlers?, objectFactory?,
 objectWrapperFactory?, reflectorFactory?, plugins?, environments?, databaseIdProvider?, mappers?)

二、利用LOG4J

在log4j.properties中

log4j.logger.com.demo.mapper=DEBUG

其实只要在你的dao层,也就是mapper的接口层日志等级设置为DEBUG即可;

 

 

mybatis结合log4j打印SQL日志

https://www.cnblogs.com/zhchoutai/p/7252184.html