【问题标题】:Why spring data parameter of type List does not printed on log like other parameters type?为什么 List 类型的 spring data 参数不像其他参数类型那样打印在日志上?
【发布时间】:2019-07-11 18:03:02
【问题描述】:

在我的 Spring Boot 应用程序中,我正在使用这些配置:

  logging.level.org.hibernate.SQL=DEBUG
   logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

打印休眠查询,然后打印参数值。

@Query( value="select h from Human h inner join com.human.Card c on c.humanId = h.id where h.card.status in :statuses " )
Page<Human> getHumanByStatus(@Param(statuses) List<Status>, Pageable pageable);

将查询打印的日志记录在没有列表值的情况下

【问题讨论】:

    标签: hibernate spring-boot spring-data


    【解决方案1】:

    尝试添加以下内容,仅此而已。

    aplication.yml

    logging:
      level:
        org.hibernate.SQL: DEBUG
        org.hibernate.type: TRACE
    

    应用程序属性

    logging.level.org.hibernate.SQL=DEBUG
    logging.level.org.hibernate.type=TRACE
    

    你也可以参考这个更多选项:How to print a query string with parameter values when using Hibernate

    【讨论】:

    • @AbdullahRamdan 如果对您有帮助,请您接受并投票支持答案。
    猜你喜欢
    • 2014-06-09
    • 2021-07-04
    • 2021-12-10
    • 2021-10-24
    • 2022-11-05
    • 1970-01-01
    • 1970-01-01
    • 2020-05-28
    • 2021-11-05
    相关资源
    最近更新 更多