zoukankan      html  css  js  c++  java
  • 如何打印完整的MYSQL带参数SQL日志信息

    在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信息

    [2020-08-04 20:27:05,273] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:88) - FETCH created: Tue Aug 04 20:27:05 CST 2020 duration: 1 connection: 587 statement: 129 resultset: 156
    [2020-08-04 20:27:05,274] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:88) - QUERY created: Tue Aug 04 20:27:05 CST 2020 duration: 1 connection: 587 statement: 128 resultset: 0 message: update item_costs set num_iid=7777777772 where id=18
    [2020-08-04 20:27:05,275] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:88) - FETCH created: Tue Aug 04 20:27:05 CST 2020 duration: 0 connection: 587 statement: 128 resultset: 0
    [2020-08-04 20:27:05,278] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:88) - QUERY created: Tue Aug 04 20:27:05 CST 2020 duration: 0 connection: 587 statement: 131 resultset: 157 message: select @@session.tx_read_only
    [2020-08-04 20:27:05,279] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:88) - FETCH created: Tue Aug 04 20:27:05 CST 2020 duration: 1 connection: 587 statement: 131 resultset: 157
    [2020-08-04 20:27:05,280] INFO com.mysql.jdbc.log.Slf4JLogger.logInfo(Slf4JLogger.java:88) - QUERY created: Tue Aug 04 20:27:05 CST 2020 duration: 0 connection: 587 statement: 130 resultset: 0 message: update skus set num_iid=7777777772 where id=19
    [2

    https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-reference-configuration-properties.html

  • 相关阅读:
    增删改查
    兴趣爱好
    兴趣爱好界面
    购物商城
    计算器
    安卓第四周作业
    安卓第一周作业
    第十五周作业
    十三周作业-集合
    第十三周上机练习
  • 原文地址:https://www.cnblogs.com/chenkeyu/p/13435740.html
Copyright © 2011-2022 走看看