Spring/SpringBoot_在控制台输出Mybatis sql日志

文章目录

Spring

在配置文件中添加设置项

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

SpringBoot

mybatis不使用xml配置文件的情况下,可以在application.yml文件中添加:

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

或者

logging:
  level:
    com.test.springboot.mapper: debug 

如果mybatis使用了xml配置,则在xml中添加配置项:

<settings>
    <setting name="logImpl" value="org.apache.ibatis.logging.stdout.StdOutImpl"/>
</settings>

建议不要xml配置与yml配置混起来用,会出现配置无效或者冲突的问题。

发布了417 篇原创文章 · 获赞 45 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/Chill_Lyn/article/details/104863967
今日推荐