我试着记录由jdbc执行的mysql语句,希望看到包含的字符串声明一些游标或获取一些游标。但事实并非如此。 有什么方法可以看到它们吗? PS我在mysql中设置变量如下:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:support-v4:23.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-v4/23.0.1/support-v4-23.0.1.pom
https://jcenter.bintray.com/com/android/support/support-v4/23.0.1/support-v4-23.0.1.jar
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.pom
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/android/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.jar
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.pom
file:/C:/Users/user/AppData/Local/Android/sdk1/extras/google/m2repository/com/android/support/support-v4/23.0.1/support-v4-23.0.1.jar
Required by:
TheFlame:app:unspecified > com.android.support:appcompat-v7:22.2.0
TheFlame:app:unspecified > com.android.support:design:22.2.0
TheFlame:app:unspecified > com.android.support:recyclerview-v7:22.2.0
答案 0 :(得分:0)
试试这个。
将'logger'和'profileSQL'添加到jdbc url:
&logger=com.mysql.jdbc.log.Slf4JLogger&profileSQL=true
然后您将获得以下SQL语句:
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 1 connection: 19130945 statement: 999 resultset: 0
2016-01-14 10:09:43 INFO MySQL - QUERY created: Thu Jan 14 10:09:43 CST 2016 duration: 1 connection: 19130945 statement: 999 resultset: 0 message: SET sql_mode='NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES'
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 1 connection: 19130945 statement: 999 resultset: 0
2016-01-14 10:09:43 INFO MySQL - QUERY created: Thu Jan 14 10:09:43 CST 2016 duration: 2 connection: 19130945 statement: 13 resultset: 17 message: select 1
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 0 connection: 19130945 statement: 13 resultset: 17
2016-01-14 10:09:43 INFO MySQL - QUERY created: Thu Jan 14 10:09:43 CST 2016 duration: 1 connection: 19130945 statement: 15 resultset: 18 message: select @@session.tx_read_only
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 0 connection: 19130945 statement: 15 resultset: 18
2016-01-14 10:09:43 INFO MySQL - QUERY created: Thu Jan 14 10:09:43 CST 2016 duration: 2 connection: 19130945 statement: 14 resultset: 0 message: update sequence set seq=seq+incr where name='demo' and seq=4602
2016-01-14 10:09:43 INFO MySQL - FETCH created: Thu Jan 14 10:09:43 CST 2016 duration: 0 connection: 19130945 statement: 14 resultset: 0
默认记录器是:
com.mysql.jdbc.log.StandardLogger
Mysql jdbc属性列表:https://dev.mysql.com/doc/connector-j/en/connector-j-reference-configuration-properties.html