How to enable Hibernate's SQL logging via logging.properties?

时光毁灭记忆、已成空白 提交于 2019-12-25 14:28:06

问题


I have removed the property hibernate.show_sql from my EntityManager creation and want to replace it with a logging level. I am using java's logging facility.

As explained in this answer I should set the log level of org.hibernate.SQL.

I have tried it with my logging.properties, but it doesn't work:

handlers=java.util.logging.ConsoleHandler
org.hibernate.level=FINE
org.hibernate.SQL.level=FINEST
org.hibernate.type.level=FINER

I had also tried ALL, but it makes no difference.

What is wrong?


回答1:


After some debugging I ended up with following configuration:

handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=FINE
org.hibernate.level=WARN
org.hibernate.SQL.level=FINE


来源:https://stackoverflow.com/questions/32483899/how-to-enable-hibernates-sql-logging-via-logging-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!