Logging database queries
Did you know you can ask our database drivers to log the queries being executed by them!
You can choose to log all queries, log slow queries, or log queries that failed.
When a query is logged it is written to the log_queries table in the database.
They can be turned on individually, or all together by adding the following to your config.php file:
$CFG->dboptions['logslow'] = 1.0; // Float: seconds with microseconds. If the query took longer than this then it will be logged. $CFG->dboptions['logerrors'] = true; // Queries that failed will be logged. $CFG->dboptions['logall'] = true; // Every single query will be logged.
There is no way via the product interface to get queries from the log table.
You will need to connect to the database and read from the table yourself.