时间:2011-07-21 11:54:15

标签: java spring logging apache-commons-dbcp

我正在创建一个包含以下属性的数据库连接池。

<bean id="complianceCCRDataSource" class="org.apache.commons.dbcp.BasicDataSource" 
        destroy-method="close" lazy-init="false" >

    <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" /> 
    <property name="username" value="${deshaw.compliance.ccr.db.username}" />
    <property name="password" value="${deshaw.compliance.ccr.db.password}" />
    <property name="url" value="${deshaw.compliance.ccr.db.url}" />
    <property name="initialSize" value="5" />
    <property name="maxActive" value="10" />
    <property name="maxWait" value="60000"/>
    <property name="testOnBorrow" value="true" /> 
    <property name="validationQuery"> 
        <value>use ${deshaw.compliance.ccr.db.name} SELECT 1 
        </value> 
    </property>
    <property name="maxIdle" value="10" />
    <property name="removeAbandoned" value="true" />
    <property name="removeAbandonedTimeout" value="600" />
    <property name="logAbandoned" value="false" />
</bean>

当我尝试实例化上面的bean时,我收到了关于STDOUT的消息。有什么方法可以压制这些吗?

   AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool@2d82ef6b)
   LogAbandoned: false
   RemoveAbandoned: true
   RemoveAbandonedTimeout: 600

1 个答案:

答案 0 :(得分:0)

您应该使用此here中所述的setLogWriter()(请参阅javadoc JIRA)方法。