Debugging
Als Administrator/in können Sie die Ausgabe von Debugging-Nachrichten auf der Seite Einstellungen > Website-Administration > Entwicklung > Debugging aktivieren.
Debugging-Nachrichten helfen bei der Analyse von Problemen oder Fehlern und sind für Entwickler/innen nützlich. Wenn Sie ein Problem mit Ihrer Moodle-Site haben und in einem der Support-Foren von moodle.org Hilfe suchen, kann es passieren, dass Entwickler/innen Sie bitten, das Debugging zu aktivieren, um mehr Informationen zur Analyse Ihres Problems zu erhalten. Standardmäßig werden in Moodle keinerlei Fehlerinformationen ausgegeben. Das Aktivieren des Debugging-Modus ist meistens ein erster Schritt zur Fehleranalyse- und behebung.
Debugging-Einstellungen
Für das Debugging können Sie folgende Einstellungen vornehmen:
Debug messages
The default is none, your choices are:
- NONE
- Do not show any errors or warnings (Default)
- ALL
- Show all reasonable PHP debug messages
- MINIMAL
- Show only fatal errors
- NORMAL
- Show warnings, errors and notices
- DEVELOPER
- 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.
Performance info
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
Helps translators.
Show validator links
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 directly
The debug settings are at the URL http://.../admin/settings.php?section=debugging
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 config.php
In moodle/config.php you can add the lines:
$CFG->debug = 2047;
$CFG->debugdisplay = 1;
Or even more debugging messages:
$CFG->debug = 6143;
$CFG->debugdisplay = 1;
For Moodle 2.0 the possible settings are as follows:
// Force a debugging mode regardless the settings in the site administration
// @error_reporting(1023); // NOT FOR PRODUCTION SERVERS!
@ini_set('display_errors', '1'); // NOT FOR PRODUCTION SERVERS!
$CFG->debug = 38911; // DEBUG_DEVELOPER // NOT FOR PRODUCTION SERVERS!
$CFG->debugdisplay = true; // NOT FOR PRODUCTION SERVERS!
// You can specify a comma separated list of user ids that that always see
// debug messages, this overrides the debug flag in $CFG->debug and $CFG->debugdisplay
// for these users only.
$CFG->debugusers = '2';
Remember to remove those lines again when you have finished diagnosing your problem.
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.)
Siehe auch
- Entwickler/innen können auch XDEBUG verwenden, um mit Hilfe einer XDEBUG Client Applikation tiefer in den Code einzudringen. XDEBUG wird als Module im Apache Webserver installiert wird.