方式一:指定mybatis日志级别
# application.yml
mybatis:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 等价于application.properties
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
方式二、Mybatis-Plus配置(如果用了 Mybatis-Plus )
# 开启mybatis-plus自带SQL打印
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
方式三、mybatis-config.xml 配置(一般是在配置文件中指定了读取 mybatis-config 才这样写)
xml
<configuration>
<settings>
<setting name="logImpl" value="STDOUT_LOGGING"/>
</settings>
</configuration>