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:
- https://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html
- http://docs.oracle.com/cd/e17952_01/mysql-monitor-2.3-en/mem-qanal-using-cj.html
hth
Comments
Post a Comment