hibernate detach utility debug

John Mazzitelli mazz at redhat.com
Fri Sep 16 18:35:02 UTC 2011


I added some configurability to the hibernate detach utility logging, 
based on some feedback by Ian. This is probably more of interest to Ian 
right now, but figured post it here for posterity.

By default, we now only log at DEBUG level the number of objects 
detached and the duration it took IF it took longer than 10 seconds. 
that's a really long time for this, so we should log that so we have a 
record of it. It is DEBUG, so you won't see it unless you turn that 
category on.

But if you are testing or have a need to analyze performance, you can 
have it log a more detailed message at a certain threshold if you set 
the sysprop "rhq.server.hibernate-detach-utility.dump-stack-thresholds" 
(you'd probably do this in rhq-server.properties).

You set it to two numbers separated by a ":". For example:

rhq.server.hibernate-detach-utility.dump-stack-thresholds=5000:10000

means a message will be logged at the WARN level IF EITHER:

1) the detach took longer that 5000 milliseconds

OR

2) the number of objects detached was over 10,000

We log the duration, number of objects AND the class of the object being 
detached (we can't log the object's toString because that would be very 
long, especially for things like large collections of compound objects).

We also log the full stack trace so we know where the object came from.

John Mazz


More information about the rhq-devel mailing list