How to enable hibernate logging using log4j

We needed to enable hibernate logging to debug an issue. Here are the quick steps.

Modify log4j.properties

log4j.properties
## configuration is adapted from www.hibernate.org ##
### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=debug, stdout
log4j.logger.org.hibernate=info
#log4j.logger.org.hibernate=debug

### log just the SQL
log4j.logger.org.hibernate.SQL=debug

We can also enable logging per hibernate package level.

Version History


Date Description
2013-10-17    Initial Version