Take the 2-minute tour ×

I am working on fixing connection timeouts issues for a project that iam working on. we use c3p0 to manage the connection pool and hibernate as the orm tool. we also use spring.

To find if there any unreturned connections, i have set debugUnreturnedConnectionStackTraces to true in my c3p0 configuration(NOT in c3p0 properties).

Is there anything else that I need to do. Do I have to add anything to my lod4j.properties also or is it just enough to set debugUnreturnedConnectionStackTraces to true?

Also, should i set debugUnreturnedConnectionStackTraces to true in c3p0 properties?

Thanks for the help

share|improve this question

2 Answers 2

Expanding a bit on Corey's answer:

If unreturnedConnectionTimeout is positive and debugUnreturnedConnectionStackTraces is set to true, then the stack traces that generated unreturned Exceptions will be logged at INFO level by the logger "com.mchange.v2.resourcepool.BasicResourcePool".

Often people log anything above INFO level from all loggers, so these stack traces just appear in your logs. But if you don't see them, do check your logging configuration to make sure messages at INFO from that logger are not filtered.

Note that debugUnreturnedConnectionStackTraces will do NOTHING if unreturnedConnectionTimeout is not also set.




I hope this helps!

p.s. it doesn't matter how you set these properties, as long as they are properly set. c3p0 dumps pool configurations at INFO on pool initiation; check your logs to make sure that, however you are trying to set parameters, you have the configuarion you expect. Alternatively you can use JMX to inspect parameters.

share|improve this answer

Personally I normally add both of the following 2 lines to my hibernate.cfg.xml

<property name="hibernate.c3p0.unreturnedConnectionTimeout">60</property>
<property name="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</property>

I believe the default value on the timeout is 0 and I'm not sure how that is supposed to work.

share|improve this answer
thanks scott. But, Is it enough if we set the 'debugUnreturnedConnectionStackTraces' to true or should I also make anychanges to my log4j.properties also. and where would 'debugUnreturnedConnectionStackTraces' log the stack traces. Will it log into the application server's logs? –  Npa Aug 3 '12 at 17:04
I dont use log4j but I would expect you would need to turn the log level to debug. And yes, it should end up in the application server log. –  Corey Scott Aug 3 '12 at 17:33

Your Answer


