dspym82000 2011-05-26 13:27 采纳率: 100%
浏览 111

是否可以配置MySQL日志记录,以便它只报告已回滚的查询?

I have an intermittent bug that I'm trying to track down, and I'd like to capture only MySQL queries that fail resulting in a rollback. I don't want a full general query or binary log because there would be millions of entries in the haystack to sort through.

Something like this solution except for MySQL would be perfect.

TIA,
JD

  • 写回答

2条回答 默认 最新

  • dqk42179 2011-05-26 13:35
    关注

    In MySQL it is very difficult (or maybe impossible). You can do it in PHP. If you don't use low functions like mysql_query and you use high methods like ->query(), you can add logic to theirs. If query failed (return false for example), add it to log. Sorry for my english.

    Note for Zend_DB:

    class My_DB extends Zend_DB {
        public function insert($data) {
            try {
                parent::insert($data);
            } catch (Exception $e) {
                // put $e->getMessage() to log
            }
        }
    }
    

    You can overwrite different methods, such as update, query and others...

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度