Last edited one month ago
by Robert Vogel

How to debug: Difference between revisions

No edit summary
No edit summary
Line 18: Line 18:


==== General debug log ====
==== General debug log ====
Sometimes it can be useful to see all debugging information the application produces. To enable this general debug log please add the following lines within you <code>LocalSettings.php</code> file:<syntaxhighlight lang="php">
if ( isset( $_GET['dodebuglog'] ) ) {
    $GLOBALS['wgDebugLogFile'] = "$IP/cache/debug.log";
}
</syntaxhighlight>Be aware that this configuration is set conditionally. It will only be used if the URL accessed in the browser contains some query string like  <code>dodebuglog=1</code>. This is to allow a more isolated debug log file. Otherwise other requests (like calls to the <code>load.php</code> entrypoint for CSS and JS content) may also add into this file, which makes analysis more difficult.


==== Log channels ====
==== Log channels ====


== Client side debugging ==
== Client side debugging ==
Many errors occur only on the client and server side debugging will not help. In such cases the webbrowser can be used to retrieve more information.


=== Browser development tools ===
=== Browser development tools ===
Most modern browsers have sophisticated development tools. Usually they can be accessed by pressing the <code>F12</code> key on the keyboard.


==== JavaScript console ====
==== JavaScript console ====


==== Network panel ====
==== Network panel ====

Revision as of 10:52, 4 December 2023

Sometimes things go wrong. In many cases the user is then confronted with cryptic or no error messages at all. This page provides help about getting more information about what exactly went wrong, so it can be fixed quickly. This is especially important when asking for help on locations like community.bluespice.com.

Additional information can also be found at "Manual:How to debug" on MediaWiki.org.

Check for sensitive informationMost of the techniques described here will output very detailed information about the error, but also about the system and the context. The output may contain sensitive information like usernames, passwords, pathes, access-keys and many more. Before posting any information retrieved by this kind of debugging on a public location (like community.bluespice.com), make sure to redact all potential sensitive information!


Server side debugging

There are various ways to get more information about errors by changing some configuration on the server side.

Wiki application

Enable detailed error reporting

Within you LocalSettings.php file, please add the following lines:

$GLOBALS['wgShowSQLErrors'] = true;
$GLOBALS['wgDebugDumpSql']  = true;
$GLOBALS['wgShowExceptionDetails'] = true;
$GLOBALS['wgShowDBErrorBacktrace'] = true;

This will turn error messages like internal_api_error_DBQueryError into a more detailed stack of program calls, including database queries and responses.

General debug log

Sometimes it can be useful to see all debugging information the application produces. To enable this general debug log please add the following lines within you LocalSettings.php file:

if ( isset( $_GET['dodebuglog'] ) ) {
    $GLOBALS['wgDebugLogFile'] = "$IP/cache/debug.log";
}

Be aware that this configuration is set conditionally. It will only be used if the URL accessed in the browser contains some query string like dodebuglog=1. This is to allow a more isolated debug log file. Otherwise other requests (like calls to the load.php entrypoint for CSS and JS content) may also add into this file, which makes analysis more difficult.

Log channels

Client side debugging

Many errors occur only on the client and server side debugging will not help. In such cases the webbrowser can be used to retrieve more information.

Browser development tools

Most modern browsers have sophisticated development tools. Usually they can be accessed by pressing the F12 key on the keyboard.

JavaScript console

Network panel



To submit feedback about this documentation, visit our community forum.