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.
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.
I came across several Logger tools that can log SQL.
- jdbcdslog-exp
- P6Spy
- JdbcProxy
- log4jdbc
- SqlRecorder
What I am specifically looking for:
- Pure SQL queries without almost little or no garbage (like the time at which the query was fired jdbcdslog-exp recorded data)
- 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.
- 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.