How to PHP ADODB log sql query



PHP ADODB library build-in an useful feature. It is SQL logging. simple to use just

$conn->LogSQL(TRUE);

please read how to use LogSQL for more info.

But many people wonder why SQL queries is not loged in to table  "adodb_logsql".
If you make sure no wrong in your code, let's check this. Open file adodb-perf.inc.php then find $ADODB_PERF_MIN variable.

adodb-perf.inc.php

global $ADODB_PERF_MIN;
$ADODB_PERF_MIN = 0.05;

Yes, adodb will log only query which spend time more than 0.05 second by default. So let's increase the value, may be 0.00001 or -1 if you want to logged any queries.

that's all.

Comments