Sentry Logger



Pushes Craft CMS logs to Sentry through a real Yii 2 log target.

Features

  • Updated to the latest Sentry SDK version 3
  • Native Yii 2 log target that is fully customisable
  • All errors and warnings for each request are sent
  • Plugin settings can be defined in the CP or with a config file
  • Calls for Craft::error() and Craft::warning() are sent and categorized
  • Anonymous option to prevent sensitive visitors and users data from being sent to Sentry

Additional data pushed to Sentry

  • Request type (web, ajax or console)
  • Request method, headers and body
  • Request route including query string
  • Script executed including parameters (console request)
  • User ID, email, username and groups (sensitive data)
  • Visitor IP address (sensitive data)
  • Visitor cookies (sensitive data)
  • Database driver type and version
  • Craft edition, licence, schema and version
  • Craft devMode status taken from general config
  • Craft current environment taken from CRAFT_ENVIRONMENT
  • Twig template path and line number for exceptions in compiled templates

Requirements

This plugin requires PHP 7.2 or later and Craft CMS 3.5 or later.

Basic configuration

You can configure the plugin settings directly in the CP or you can create a config/sentry-logger.php config file with the following contents. Make sure to update your .env environment file accordingly with the correct values.

<?php

use craft\helpers\App;

return [

    '*' => [
        'enabled' => false,
        'anonymous' => false,
        'dsn' => App::env('SENTRY_DSN'),
        'release' => App::env('SENTRY_RELEASE'),
        'environment' => App::env('SENTRY_ENVIRONMENT'),
        'levels' => ['error', 'warning'],
        'exceptCodes' => [403, 404],
    ],

    'staging' => [
        'enabled' => true,
    ],

    'production' => [
        'enabled' => true,
    ],

];

Advanced configuration and parameters

Read through the documentation to know how to use the advanced configuration method and all the available parameters.


Free

Package Name

To install this plugin, search for its package name on the Plugin Store and click “Install”.


Information

Report an issue