title: Log SQL that is communicated with the database
body: <p>I am working on a SQL Logger for my web application. I want to be able to Log the SQL query that is fired by user-interaction with the GUI. I'm working in a Spring environment, working with maven and mybatis. I package my webapp into a war and deploy it onto tomcat.</p>
  
  <p>I want to be able to use the SQL directly to access the database. I can try and use a SocketAppender/HTMLAppender like in Log4j, and post the queries so that other non-SQL people can use it directly without editing it, or removing garbage from the queries to see the populated data.</p>
  
  <p>I came across several Logger tools that can log SQL.</p>
  
  <ol>
  <li>jdbcdslog-exp</li>
  <li>P6Spy</li>
  <li>JdbcProxy</li>
  <li>log4jdbc</li>
  <li>SqlRecorder</li>
  </ol>
  
  <p>What I am specifically looking for:</p>
  
  <ol>
  <li>Pure SQL queries without almost little or no garbage (like the time at which the query was fired <a href="https://code.google.com/p/jdbcdslog-exp/wiki/UserGuide" rel="nofollow">jdbcdslog-exp recorded data</a>)</li>
  <li>If I get a little unwanted data I want to be able to remove it to generate pure queries. I'm trying to figure out how jdbcdslog does it, but having a hard time trying to make it work.</li>
  <li>I want to know if any of the above tools can provide us some metadata about the queries (like which package did the query belong to), so that I can separate out my log data as per packages.</li>
  </ol>