title: Dump leak connections in WildFly
body: <p>I am trying to dump leaked connections managed by a MySQL Data Source in WildFly 10.1, but I am not able to find the leak file or the leak dump.</p>
  
  <p>Why is the <code>leaks.txt</code> file not being generated? And also, where should I look for the file?</p>
  
  <h2>Procedure</h2>
  
  <p>I registered the leak connection pool in the <code>standalone.bat</code> file:</p>
  
  <pre><code>"JAVA_OPTS=%JAVA_OPTS% -Dironjacamar.mcp=org.jboss.jca.core.connectionmanager.pool.mcp.LeakDumperManagedConnectionPool -Dironjacamar.leaklog=leaks.txt"
  </code></pre>
  
  <p>I can confirm that properties are being set in WildFly since shows in the log:</p>
  
  <pre><code>JAVA_OPTS: "-Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Dironjacamar.mcp=org.jboss.jca.core.connectionmanager.pool.mcp.LeakDumperManagedConnectionPool -Dironjacamar.leaklog=leaks.txt"
  </code></pre>
  
  <p>After it, I leak some connections in my mock application in order to generate data. Then I run the CLI command flushing all connections getting a positive response:</p>
  
  <pre><code>[standalone@localhost:9990 /] /subsystem=datasources/data-source=mysql-ds:flush-all-connection-in-pool
  {"outcome" =&gt; "success"}
  </code></pre>
  
  <p>But I can't find the <code>leaks.txt</code> file anywhere.</p>
  
  <p>I am using <a href="http://www.mastertheboss.com/jbossas/wildfly9/detecting-connection-leaks-in-wildfly-9" rel="nofollow noreferrer">this article</a> and also <a href="http://www.ironjacamar.org/doc/userguide/1.2/en-US/html_single/index.html#configuration_ironjacamar_leakpool" rel="nofollow noreferrer">IronJacamar leak documentation</a> as reference.</p>
  
  <blockquote>
    <p>The leak detector pool is configured using the ironjacamar.mcp system
    property with a value of</p>
    
    <p><code>org.jboss.jca.core.connectionmanager.pool.mcp.LeakDumperManagedConnectionPool</code></p>
    
    <p>This configuration applies to all connection pools used by IronJacamar.</p>
    
    <p>The system property ironjacamar.leaklog can be used to have the leaks
    dumped out into a special file separate from the logging setup.</p>
    
    <p>An example</p>
    
    <p><code>-Dironjacamar.mcp=org.jboss.jca.core.connectionmanager.pool.mcp.LeakDumperManagedConnectionPool
    -Dironjacamar.leaklog=leaks.txt</code></p>
  </blockquote>
  
  <h2>Updates</h2>
  
  <p>Thread <a href="https://developer.jboss.org/message/969369" rel="nofollow noreferrer">969369</a> created in JBoss forum so they can help with it as well.</p>
  
  <p>Bug reported <a href="https://issues.jboss.org/browse/JBJCA-1360" rel="nofollow noreferrer">JBJCA-1360</a>.</p>