devel:debugging
Table of Contents
Debug tools
DokuWiki has debugging tools. Some need to be configured.
Enable debugging
When config option allowdebug is enabled you can:
- Appending
?do=debug
or&do=debug
to URL so DokuWiki will output a huge list of debug strings. - (Up to Hogfather 2020 release: Look up output of
dbglog()
indata/cache/debug.log
) - Receive additional error messages e.g. from some authentication backends
- Appending
?httpdebug
or&httpdebug
to URL to enable debugging output in DokuWiki's HTTPClient - Return some messages if stylesheets are missing
- Receive additional comments in xhtml renderer output
- Get some fallback try-catches in the compiled javascript file via
js.php
- Get debugging at some other locations and in plugins or templates, see the codesearch for usage allowdebug
Enabling logging
Since Igor 2022 release:
DokuWiki has a logging functionality. Which information is not logged can be set with the dontlog config setting.
- Default only error and deprecated messages are logged, and the debug log is disabled.
- You can also enable debug log for more debug output
- Via the admin interface you can use the LogViewer. If the LogViewer cannot be reached, you can find the log files in your file system in e.g.
[wiki_folder]/data/log/error/<date>.log
.
Get page and user info
Appending ?do=check
or &do=check
to URL triggers the action mode check that provides some information about the users permissions and the DokuWiki setup.
Debugging TaskRunner
See the debug info at the task runner page.
Debug functions
dbg($msg)
Insert a code block in the wikipage filled by $msg as plain text.
Adding an extra argument todbg($msg, $hidden=true)
will return the $msg as html comment.
dbglog($msg)
Writes $msg to the debug log shown in LogViewer, stored in[wiki_folder]/data/log/debug/<date>.log
whendebug
is unchecked in the dontlog setting.
(Upto Hogfather 2020 release: it wrote to the log in the cache directorydata/cache/debug.log
when the config allowdebug is enabled.) Be aware the log isn't emptied automatically.
Usedbglog($msg, 'Header above log message')
for including a header above $msg.
dbg_deprecated($alternative = '')
Function to mark deprecated functions. Each call is logged to the deprecated log shown in LogViewer, whendeprecated
is unchecked in the dontlog setting. The log message mentions: the name of the deprecated function, the function using it, its file and line and the$alternative
when provided.
dbg_backtrace()
Print a reversed, prettyprinted backtrace
debug_guard($data)
When you write your own debug functionality, use this function to remove all data from an array where the key seems to point to sensitive data.
Sentry Plugin
The Sentry Plugin allows you to log extensive information to the Sentry service. This is especially useful when running beta tests within a live environment.
See also
- Configuration option allowdebug
- I got a blank page or Error 500 (Internal Server Error)
devel/debugging.txt · Last modified: 2022-10-20 12:47 by Klap-in