mybatis打印sql日志

一、 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即可;



原文链接:https://www.cnblogs.com/zhangmms/p/8973068.html

欢迎留言