Thursday 10 March 2011

Logging bind variables with hibernate

You could use something like p6spy as suggested by a friend of mine Andy, but I wanted something that was trivial to configure and potentially available to the live application and easy to set up.

After a bit of digging I found Sathya's blog with the solution I needed.

I already had the log4j jar.
What I was missing was the slf4j-log4j12 jar

and the following line in my log4j.properties

log4j.logger.org.hibernate.type=TRACE