title: Trying to identify source of abandoned connections in tomcat
body: <p>I'm using dbcp connection pooling in tomcat (version 7) and I have a connection leak somewhere in my code. After a short amount of time, a request for a new connection returns the following exception:</p>
  
  <p>"Cannot get a connection, pool error Timeout waiting for idle object"</p>
  
  <p>I went back through my code and to me it looks like all connections are being closed properly (doesn't everyone say this...).</p>
  
  <p>In order to debug this I added the following properties in context.xml:</p>
  
  <pre><code>logAbandoned="true" removeAbandoned="true" removeAbandonedTimeout="300"
  </code></pre>
  
  <p>So the resource tag now looks like this:</p>
  
  <pre><code> &lt;Resource name="jdbc/findata" auth="Container" type="javax.sql.DataSource"
                 maxActive="20" maxIdle="5" maxWait="10000"
                 username="root" password="xxxxxx" driverClassName="com.mysql.jdbc.Driver"
                 logAbandoned="true" removeAbandoned="true" removeAbandonedTimeout="300"
                 url="jdbc:mysql://localhost:3306/findata"/&gt;
  </code></pre>
  
  <p>I then restarted tomcat and started hitting web pages until the error message appeared (in the browser window). However I haven't yet been able to figure out where the "logAbandoned" property is writing its information. I'm looking in </p>
  
  <pre><code>/usr/share/apache-tomcat-7.0.11/logs
  </code></pre>
  
  <p>but the only recently modified log file in there is </p>
  
  <pre><code>localhost_access_log.2011-04-18.txt
  </code></pre>
  
  <p>Any assistance is much appreciated.</p>