/
Logging database queries
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.
Related content
Slow query logging
Slow query logging
More like this
How to log slow queries
How to log slow queries
More like this
Enabling debugging in GraphQL APIs
Enabling debugging in GraphQL APIs
More like this
How to obtain SQL code and parameters for a report
How to obtain SQL code and parameters for a report
More like this
Configuring Totara for development
Configuring Totara for development
More like this