Debugging Hibernate using Log4J Logs

People who work with Hibernate often want to see, what SQL it is prepairing behind the seen and how it is mapping in real for debug purpose. We can achieve this by enable log4j for Hibernate classes. This will give a detailed debug info.

If using, enter the below line at end:

### log JDBC bind parameters ###

### log prepared statement cache activity ###

If using log4j XML file, enter below line before <root>:

<logger name="org.hibernate">
    <level value="debug"/>

<logger name="org.hibernate.SQL">
    <level value="debug"/>

<logger name="org.hibernate.type">
    <level value="debug"/>

Happy Coding 🙂

About nitingautam

I am Tech Lead (Java/J2EE/ExtJs) with a MNC located @ Gurgaon.
This entry was posted in debug, hibernate, Java. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *