Location: Settings > Site administration > Development > Debugging
Debugging messages are intended to help diagnose problems and/or help Moodle developers. If you have a problem with your Moodle site and ask for help in a Moodle.org forum, a developer may ask you to turn debug messages on, in order to locate the cause of the problem. By default Moodle does not show any error messages at all. If you are having problems (e.g. blank screens or incomplete screens) turning on debugging is usually the first thing to try.
- 1 Debugging settings
- 2 What to do if you cannot get to the admin screens
- 3 See also
Here are the settings on the Debugging page:
The default is none, your choices are:
- Do not show any errors or warnings (Default)
- Show all reasonable PHP debug messages
- Show only fatal errors
- Show warnings, errors and notices
- extra Moodle debug messages for developers
There is rarely any advantage in going to Developer level, unless you are a developer, in which case it is strongly recommended.
Once you have got the error message, and copied and pasted it somewhere. HIGHLY RECOMMENDED to turn Debug back to NONE. Debug messages can give clues to a hacker as to the setup of your site.
Display debug messages
There is an option to choose whether to display error messages or simply record them in the server logs.
Debug email sending
Determines whether or not to enable verbose debug information during sending of email messages to SMTP server.
The Performance info option determines whether performance info will be included in the footer of the standard theme (and some other themes). Performance info includes the time for the page to load, the amount of memory used to generate the page, cpu usage, load, and the record cache hit/miss ration.
If you add
define('MDL_PERF', true); define('MDL_PERFDB', true); define('MDL_PERFTOLOG', true); define('MDL_PERFTOFOOT', true);
to your config.php file, then it will also count database queries. (This has to be in config.php, because Moodle starts doing DB queries before it loads the config information in the database!
Show origin of language strings
Be careful, read the warning.
Show page information
To show page information printed in the page footer.
What to do if you cannot get to the admin screens
If the error is stopping you even getting to the admin screens to turn on debugging, then you can set the debugging setting manually.
Try typing the URL directlyThe debug settings are at the URL
on your server. Sometimes that URL will work, even though the pages you need to go to to get there (for example the site front page) do not. So it is worth trying to enter that URL directly.
In the database
Using a tool like phpMyAdmin, execute the following SQL commands:
UPDATE mdl_config SET VALUE = 2047 WHERE name = 'debug'; UPDATE mdl_config SET VALUE = 1 WHERE name = 'debugdisplay';
To turn it back off, use the admin screens, or the commands:
UPDATE mdl_config SET VALUE = 0 WHERE name = 'debug'; UPDATE mdl_config SET VALUE = 0 WHERE name = 'debugdisplay';
(If you use a different database prefix, you will need to adjust those commands accordingly.)
- Using Moodle Debugging Turned on to Developer Mode on 1.8.2 forum discussion including instructions on how to turn debugging off
- Developers can also use XDEBUG (Installed as a module on the Apache server) to further dig into the code, step by step using an XDEBUG client application. Probably, as part of their favorite IDE. For example: NetBeans, phpStorm or...