MyBatis输出SQL日志

方式一: 指定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-config.xml

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

方式三:指定整个mapper包下的日志级别

# application.yml
logging:
  level:
    com.example.demo.mapper: debug

# 等价于application.properties
logging.level.com.example.demo.mapper=debug

方式三:指定整个mapper包下的日志级别

# application.yml
logging:
  level:
    com.example.demo.mapper: debug

# 等价于application.properties
logging.level.com.example.demo.mapper=debug

参考

  1. SpringBoot+MyBatis如何配置log4j日志输出(sql)
  2. spring boot如何打印mybatis的执行sql
上一篇:Angular input控件的click事件响应处理的调用上下文


下一篇:Java中的native修饰符