Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
807 views
in Technique[技术] by (71.8m points)

connection - How to configure hibernate.c3p0.debugUnreturnedConnectionStackTraces properly

Searched almost everywhere for the solution but did not find any direction. I want debug logs printed for unreturned connection stacktrace for c3p0 connection pooling. I have following properties set in configuration for hibernate apart from other properties of c3p0.

i.e.

          <beans:prop key="hibernate.c3p0.unreturnedConnectionTimeout">30</beans:prop>
          <beans:prop key="hibernate.c3p0.debugUnreturnedConnectionStackTraces">true</beans:prop>

other properties are

            <beans:prop key="hibernate.generate_statistics">true</beans:prop>
            <beans:prop key="hibernate.c3p0.min_size">5</beans:prop>
            <beans:prop key="hibernate.c3p0.max_size">20</beans:prop>
            <beans:prop key="hibernate.c3p0.timeout">300</beans:prop>
            <beans:prop key="hibernate.c3p0.max_statements">50</beans:prop>
            <beans:prop key="hibernate.c3p0.idle_test_period">3000</beans:prop>

Other properties are getting printed in logs at the time of spring container initialization as

             com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource - Initializing c3p0 pool... 
             com.mchange.v2.c3p0.PoolBackedDataSource@22c564ca [ connectionPoolDataSource -> 
             com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@2e5953fe [ acqui...

But for all unreturned connections i am unable to see any logs related.

Here are my other configurations in log4j.xml

            <appender name="console" class="org.apache.log4j.ConsoleAppender">
                      <param name="Target" value="System.out" />
                      <layout class="org.apache.log4j.PatternLayout">
                         <param name="ConversionPattern" value="%-5p: %c - %m%n" />
                      </layout>
             </appender>
             <logger name="com.mchange.v2.c3p0">
                 <level value="info"/>
             </logger>

Is there anything i am missing to configure. Please help.

question from:https://stackoverflow.com/questions/65903172/how-to-configure-hibernate-c3p0-debugunreturnedconnectionstacktraces-properly

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...