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 environm
i use jdbcdslog-exp for cases like this.
add jdbcdslog-1.0.6.2.jar to classpath.
add categories to log4j configuration (set INFO for ResultSetLogger too if you want - beware of OutOfMemory)
if you need to switch statement logging by runtime you can start your log4j with
PropertyConfigurator.configureAndWatch("log4j.xml", 60000);
change your jdbc connection parameters (here example for hsql in jboss)
from
jdbc:hsqldb:hsql://localhost:1801
org.hsqldb.jdbcDriver
to
jdbc:jdbcdslog:hsqldb:hsql://localhost:1801;targetDriver=org.hsqldb.jdbcDriver
org.jdbcdslog.DriverLoggingProxy