在mysql的jdbc中开启sql分析,如下:
jdbc.url=jdbc:mysql://127.0.0.1/test?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&logger=com.mysql.jdbc.log.Slf4JLogger&profileSQL=true
如此便可以生成完整的SQL信息
[-- ::,] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:) - FETCH created: Tue Aug :: CST duration: connection: statement: resultset:
[-- ::,] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:) - QUERY created: Tue Aug :: CST duration: connection: statement: resultset: message: update item_costs set num_iid= where id=
[-- ::,] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:) - FETCH created: Tue Aug :: CST duration: connection: statement: resultset:
[-- ::,] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:) - QUERY created: Tue Aug :: CST duration: connection: statement: resultset: message: select @@session.tx_read_only
[-- ::,] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:) - FETCH created: Tue Aug :: CST duration: connection: statement: resultset:
[-- ::,] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:) - QUERY created: Tue Aug :: CST duration: connection: statement: resultset: message: update skus set num_iid= where id=
[
https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-configuration-properties.html