• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

log hibernate sql statement

 
avihai marchiano
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using Jboss server.
I add to jboss.lo4j the following categories:

<category name="org.hibernate">
<priority value="DEBUG"/>
<appender-ref ref="APPLICATIONNAME_FILE" />
</category>

<!-- Log SQL statements-->
<category name="org.hibernate.SQL">
<priority value="DEBUG"/>
<appender-ref ref="APPLICATIONNAME_FILE" />
</category>

<!-- Log the values assigned to the SQL parameters and results -->
<category name="org.hibernate.type">
<priority value="DEBUG"/>
<appender-ref ref="APPLICATIONNAME_FILE" />
</category>


It prints the sql and other stuff , but it dosnt print the parameters.

Can you please help?

Thank you
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi avihai,

open your JBoss' log4j.xml or jboss-log4j.xml (depends on your JBoss version) and add the following lines instead of yours above:



You were quite near a solution . You only had the log level too high. Use TRACE instead of DEBUG. The category for logging parameter binding as you already mentioned is org.hibernate.type at the TRACE log level.

After that you can find log entries similar to:



Good Luck,
Darya
[ September 13, 2007: Message edited by: Darya Akbari ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic