Skip to main content

Controlling Logging of NetBeans Hibernate Module

Posted by wsnyder6 on May 21, 2009 at 6:57 AM PDT

I am writing a utility to import issue data from one db to another and am using the built in Hibernate support in NetBeans. The reverse engineering and other wizards have made this pretty painless.

However, the Hibernate logging can get out of control. Since Hibernate uses java.util.logging you can overwrite the existing NetBeans/Hibernate logging configuration using the java.util.logging.config system property.

Here is a sample config file example.

Related Topics >>


Our experience with Hibernate

Our experience with Hibernate logging is an object lesson in configuring logging properly. We released an application into live that didn't seem to be performing much better than on the development machines - a bit of a disappointment as our development machines are single core Intel P-not-very-big-processors running Windows XP and the production server is a 64bit dual core system, oozing ram, running Linux. After a bit of head scratching and poking around we realised Hibernate was logging at DEBUG level and each transaction was logging around 18,500 lines in the server log, even though we had the log level set to WARN in the properties file. What we hadn't done was place the logger's jar (we use log4j - it works for us) into the server's class path. Once we'd done that the improvement in performance was spectacular to say the least and we can read the logs now!