SpringBoot集成JPA,控制台输出SQL语句

在写项目时用到了JPA,想看SQL输出,发现使用logging.level.xxx.xxx.dao=debug 不好使,在这里记录一下:

在application.yml中添加:

jpa:
    show-sql: true
    properties:
      hibernate:
       format_sql: true  #格式化SQL,如果不加,SQL输出不换行,不方便查看

在application.properties中添加:

spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true

猜你喜欢

转载自blog.csdn.net/zhuzicc/article/details/104525709