gpt4 book ai didi

hibernate - spring.jpa.properties.hibernate.generate_statistics=true 不工作

转载 作者:行者123 更新时间:2023-12-04 15:42:11 27 4
gpt4 key购买 nike

无法启用 hibernate 统计

嗨。我目前正在寻找优化数据库持久性的方法。我在我的 SpringBoot 服务中使用 JPA Hibernate,我想检查我的查询是否正在使用批处理。

要检查这一点,我需要启用 hibernate 统计日志。我已经在我的 application.properties 中添加了这两个:

spring.jpa.properties.hibernate.generate_statistics=true

logging.level.org.hibernate.stat=调试

但我的应用程序似乎忽略了这些设置。

您知道为什么没有显示统计信息吗?

谢谢。

最佳答案

与 hibernate-core-5.4.10.Final 有同样的问题,这为我启用了统计信息:

<logger name="org.hibernate.engine.internal.StatisticalLoggingSessionEventListener" level="INFO"/>

我的日志文件中的示例输出:

2020-02-13 17:27:57,188 [main]  INFO (o.h.e.i.StatisticalLoggingSessionEventListener:258 end) - Session Metrics {
700 nanoseconds spent acquiring 1 JDBC connections;
0 nanoseconds spent releasing 0 JDBC connections;
2500 nanoseconds spent preparing 1 JDBC statements;
678100 nanoseconds spent executing 1 JDBC statements;
0 nanoseconds spent executing 0 JDBC batches;
0 nanoseconds spent performing 0 L2C puts;
0 nanoseconds spent performing 0 L2C hits;
0 nanoseconds spent performing 0 L2C misses;
939200 nanoseconds spent executing 1 flushes (flushing a total of 1 entities and 0 collections);
0 nanoseconds spent executing 0 partial-flushes (flushing a total of 0 entities and 0 collections)

关于hibernate - spring.jpa.properties.hibernate.generate_statistics=true 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57478685/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com