Site icon Osclass Documentation & Knowledge Base

Database debug mode

Note: This will have a performance impact on your site, so make sure to turn this off in your production site.

OSC_DEBUG_DB – saves the database queries to an array and at the end of the execution the queries are displayed at the end the page. The information saves each query: the sql string, how long that query took to execute, the sql number error and string if there has been some sql error.

Database logs

OSC_DEBUG_DB_LOG – logs the sql queries to a file called queries.log in oc-content folder. If you want to debug the sql queries of the AJAX calls or cron, you must use OSC_DEBUG_DB_LOG because we can’t print these at the end of the page (this would cause json content not to be valid json).

If Apache doesn’t have write permissions, you may need to create the file first and set the appropriate permissions (i.e. use 666).

OSC_DEBUG_DB_EXPLAIN – run an EXPLAIN query for each select query and logs the result to a file called explain_queries.log queries. It should be used only during the development of OSClass, themes or plugins to see the performance of the queries.

Remember, if Apache doesn’t have write permissions, you may need to create the file first and set the appropriate permissions (i.e. use 666).

Please enter following lines to your config.php file to see change. You must be logged in as administrator into your site to be able to see queries at bottom of page.

define('OSC_DEBUG_DB', true);                -- enable DB log
define('OSC_DEBUG_DB_LOG', true);            -- save DB log into oc-content/queries.log
define('OSC_DEBUG_DB_EXPLAIN', true);        -- run Explain for each SQL query and save to oc-content/explain_queries.log

PHP/error debug mode:
https://docs.osclasspoint.com/debug-php-errors