Hibernate - during an exception log sql and all parameters

最后都变了- 提交于 2020-06-29 03:49:17

问题


How do I get hibernate to fully log all details when an exception is thrown? I would like to see the full (not truncated) sql and the full (not truncated) parameters.

ie Hibernate is throwing:

Caused by: org.hibernate.exception.DataException: could not execute statement
long stack trace
Caused by: java.sql.SQLDataException: Incorrect string value:
Query is: blah blah blah ... 

I don't want to see any "..." there. I want to see the full sql and the full parameter list.

This is an unchecked exception. What is the configuration needed for this (and any other hibernate exceptions) to be fully logged?

As this is production code I would prefer not changing the jdbc driver to net.sf.log4jdbc.DriverSpy

(Left out the truncated sql + parameters for clarity)

来源:https://stackoverflow.com/questions/62194713/hibernate-during-an-exception-log-sql-and-all-parameters

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