I have been using Hibernate very successfully, but today I noticed a bizarre phenomenon to do with logging. If I turn on logging (at a "debug" level) for the classes underneath org.hibernate
(for instance org.hibernate.SQL
or org.hibernate.impl.SessionImpl
), I get twice each log line corresponding to those classes. I never see that with logging any other package.
Here's an excerpt from a log output. The first and fourth lines are mine, the others are Hibernate's:
23:54:45,472 TRACE UserDaoImpl:37 - Loading User by id: 2
23:54:45,473 DEBUG SQL:401 - select user0_.id as id22_2_, user0_.avatar as avatar22_2_, ...
23:54:45,473 DEBUG SQL:401 - select user0_.id as id22_2_, user0_.avatar as avatar22_2_, ...
23:54:45,499 TRACE PropertyDaoImpl:40 - Loading class com.myapp.locale.Region with ID 21
23:54:45,503 DEBUG SQL:401 - select region0_.id as id19_1_, region0_.code as code19_1_, ...
23:54:45,503 DEBUG SQL:401 - select region0_.id as id19_1_, region0_.code as code19_1_, ...
Evidence from the side of the database shows that the commands are sent only once each (fortunately!).
I use Hibernate-Annotations 3.3.1.GA
with the PostgreSQL JDBC connector 5.0.7
and log4j 1.2.14