It's better when it's simple

User Tools

Site Tools


sentry Plugin

Compatible with DokuWiki


plugin Log errors to Sentry

Last updated on
Helper, Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with devel, logging

A CosmoCode Plugin

This plugin will log errors and exceptions in DokuWiki's PHP backend and the JavaScript frontend to a Sentry instance. You can either use or a self hosted instance.


Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Privacy Info: when you install this plugin in a live wiki, you probably need to inform your users that their personal information (username, email, IP-Address, browser info) is logged to Sentry in case of an unforeseen error. Sentry also offers some detailed setting to configure how long personal data is retained.



Use the extension manager and configure the DSN to you sentry project. You can find it under ProjectSettingsClient Keys.

It should look like this: https://<public>:<secret>@<sentryinstance>/<projectid>.

You can configure which kind of errors should be logged via the errors configuration setting. It defaults to what is set for PHP's error_reporting and accepts the same integer. You can use this calculator to figure out the value you want.

The env variable allows you to easily differentiate between multiple wikis being logged into the same Sentry. This is useful when you have a local development and a live wiki for example.


Once installed and configured, it will log all unhandled errors to Sentry automatically.

You can also use it in your code for specialized logging.


To log an error use the helper plugin:

try {
    // some code
} catch(\Exception $e) {
    $sentry = plugin_load('helper', 'sentry');
    if($sentry) $sentry->logException($e);
    msg(hsc($e->getMessage()), -1);

The helper plugin exposes some more public methods in case you need more control.

You can also use the following to log an arbitrary message and additional data. (Useful when debugging problems on a live server):

$sentry = plugin_load('helper','sentry');
if($sentry) {
     $sentry->logMessage('my log message', array( 'something' => $info) );


To log an error, call the SentryPlugin.logSentryException() method.

try {
    // some code
} catch(error) {
    window.SentryPlugin && SentryPlugin.logSentryException(error, {});
plugin/sentry.txt · Last modified: 2020-07-02 23:51 by andi

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki