Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get in my logger, the duration of each hibernate query in ms

Tags:

java

hibernate

I would have to display in my console log, the duration of each Hibernate query. Is it possible ?

like image 860
Kévin_Bransard Avatar asked Nov 28 '25 23:11

Kévin_Bransard


1 Answers

Take a look on this article. http://www.basilv.com/psd/blog/2008/hibernate-and-logging

It seems it describes exactly what you need. I hope it is still relevant fore newer versions of Hibernate since hibernate moved to SLF4J. In this case you should perform appropriate configuration of SLF4J instead of Log4j

like image 50
AlexR Avatar answered Dec 01 '25 11:12

AlexR