diff --git a/developer_manual/digging_deeper/debugging.rst b/developer_manual/digging_deeper/debugging.rst index 3c541af3a..65423f3fe 100644 --- a/developer_manual/digging_deeper/debugging.rst +++ b/developer_manual/digging_deeper/debugging.rst @@ -85,6 +85,31 @@ Debugging HTML and templates By default Nextcloud caches HTML generated by templates. This may prevent changes to app templates, for example, from being applied on page refresh. To disable caching, see Debug mode. +Debugging SQL queries +--------------------- + +When encountering database errors during queries or migrations, it can be helpful to get a full query log. + +Debugging MariaDB queries +~~~~~~~~~~~~~~~~~~~~~~~~~ + +MariaDB can log all queries to a file or a table. + +.. code-block :: sql + + SET GLOBAL general_log = 'ON'; + SET GLOBAL log_output = 'table'; + +These global settings will enable the log on the fly. No database restart is required. + +.. code-block :: sql + + SELECT * FROM mysql.general_log + +This queries all the logged queries. + +.. Note:: On :ref:`continuous integration` this trick can give you the SQLs of various types and versions of a database quite easily in case you have to debug a matrix of setups. + Using alternative app directories ---------------------------------