logging - Enabling MySQL general query log with JDBC -


is there way enable mysql general query logging through jdbc? closest thing have found through search ability log slow queries through jdbc (http://dev.mysql.com/doc/refman/5.5/en/connector-j-reference-configuration-properties.html). maybe should , set slow query threshold 0 ms?

i log queries through mysql in human-readable format , specify location log file should written. know take performance hit, application has 1 user , simple enough surprised if performance hit noticeable. try out anyway see.

i believe option have turn on binary logging , use mysqlbinlog convert binary logs human-readable format, sounds general query log provide simpler means of getting want.

you can enable logging in jdbc url this:

jdbc:mysql://host/db?logger=com.mysql.jdbc.log.log4jlogger&profilesql=true 

other logging backends available (commonslogger, slf4jlogger, jdk14logger). believe direct log4j logging dropped @ point due licencing issues might not work version of jdbc driver.

naturally, you'll need relevant logging library's jar in classpath, , configuration file (log4j.properties). set root level trace first see what's happening , tighten log level , category once see what's being logged.

further reading:

hth


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -