一尘不染

奇怪的错误:通过客户堆栈跟踪关闭

hibernate

大家好,我有一个使用Hibernate检索数据库中数据的Web应用程序。并且在服务器端,某些想法会定期出现。以下是异常日志。

    16:04:22,227 DEBUG NewPooledConnection:491 - com.mchange.v2.c3p0.impl.NewPooledConnection@ef46613 closed by a client.
    java.lang.Exception: DEBUG -- CLOSE BY CLIENT STACK TRACE
        at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:491)
        at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:191)
        at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)
        at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)
        at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
    16:09:42,310 DEBUG C3P0PooledConnectionPool:476 - Successfully destroyed PooledConnection: com.mchange.v2.c3p0.impl.NewPooledConnection@32ef0763
    16:09:42,310 DEBUG BasicResourcePool:967 - Successfully destroyed resource: com.mchange.v2.c3p0.impl.NewPooledConnection@32ef0763
    16:09:42,310 DEBUG GooGooStatementCache:319 - ENTER METHOD: closeAll( org.postgresql.jdbc4.Jdbc4Connection@42df0af8 )! -- num_connections: 1

有人可以帮我解决这个问题吗?非常感谢!


阅读 234

收藏
2020-06-20

共1个答案

一尘不染

这是触发C3P0中此日志语句的代码:

if ( logger.isLoggable( MLevel.FINEST ) )
  logger.log( MLevel.FINEST, this + " closed by a client.", 
            new Exception("DEBUG -- CLOSE BY CLIENT STACK TRACE") );

注意:

  1. 这也不是例外,new Exception它仅用于显示调试目的的执行路径。

  2. 是的,这只是一条调试消息(实际上FINEST是中的最低级别java.util.logging)。

总结一下:忽略并调整您的日志记录级别以跳过这些级别。

2020-06-20