Пользовательский Hibernate StatisticalLoggingSessionEventListener в Spring Boot - PullRequest
0 голосов
/ 23 марта 2020

Я установил свойство hibernate.generate_statistics как true, но оно только регистрирует значения. Я хочу использовать эти значения прагматично, чтобы рассчитать время пакетной обработки.

INFO org.hibernate.engine.internal.StatisticalLoggingSessionEventListener [http-nio-8080-exec-1] Session Metrics {
98850765 nanoseconds spent acquiring 1 JDBC connections;
0 nanoseconds spent releasing 0 JDBC connections;
99392298 nanoseconds spent preparing 2 JDBC statements;
103100327 nanoseconds spent executing 1 JDBC statements;
102653275 nanoseconds spent executing 1 JDBC batches;
0 nanoseconds spent performing 0 L2C puts;
0 nanoseconds spent performing 0 L2C hits;
0 nanoseconds spent performing 0 L2C misses;
121461164 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)

}

есть ли способ использовать пользовательский StatisticalLoggingSessionEventListener при загрузке Spring? Мне нужно это значение "102653275 наносекунд, потраченных на выполнение 1 JDB C пакетов" .

...