How do I enable logging for Hibernate's SQL + the JDBC query parameters used in that SQL?
I am already able to successfully get the SQL to display, it just doesn't have the query parameters included. E.g.:
Hibernate:
select
container0_.CONTAINER_VERSION_ID as CONTAINER1_0_,
container0_.CONTAINER_ID as CONTAINER2_0_,
container0_.LAST_MODIFIED_DATE as LAST3_0_,
container0_.STATE as STATE0_,
container0_.TYPE as TYPE0_
from
CONTAINERS container0_
where
container0_.CONTAINER_ID=?
and container0_.STATE=?
Getting the SQL to display was done via the database spring context XML file:
org.hibernate.dialect.Oracle10gDialect
thread
org.hibernate.cache.NoCacheProvider
false
${hibernate.show.sql}
${hibernate.format.sql}
5
true
true 1, false 0
And then setting the hibernate.show.sql and hibernate.format.sql properties to true in my local .properties file:
hibernate.show.sql=true
hibernate.format.sql=true
To get the JDBC parameters to log,
this StackOverflow thread indicates that I should be able to set:
log4j.logger.org.hibernate.type=trace
or
log4j.logger.org.hibernate.SQL=trace
for Hibernate 3.2.x
I've tried doing this in both my local .properties file (localdevelopment_webContent.properties file in my case), and additionally by updating my local logging config XML file
But nothing seems to work. I know there aren't too many others working on the WebContent module, but is there anyone in another module that uses Hibernate that has successfully gotten these parameters logging with Cobalt? Perhaps foldering?