php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #46355 Query logger
Submitted: 2008-10-21 11:07 UTC Modified: 2008-10-22 10:09 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: olafvdspek at gmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 6CVS-2008-10-21 (CVS) OS: *
Private report: No CVE-ID: None
 [2008-10-21 11:07 UTC] olafvdspek at gmail dot com
Description:
------------
Hi,

Could you add a (MySQL) query logger? It'd log each query, including the duration and number of rows affected. This is very useful to diagnose slow pages.

See below for an idea of what interface could be provided.

Reproduce code:
---------------
mysql_log_queries(true);
mysql_query("select * from T");
$a = mysql_get_log();
foreach ($a as $row)
{
    printf("%.1f ms - %d rows - %s", $row['duration'], $row['affected_rows'], htmlspecialchars($row['query']));
}

Expected result:
----------------
-

Actual result:
--------------
-

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-22 10:09 UTC] johannes@php.net
You can use the MySQL Proxy or build an abstraction layer on top of the mysql functions for doing that. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 08:01:29 2024 UTC