Catches exceptions natively with Yii2's log component and sends them to Sentry.
Uses Sentry PHP SDK v2 via olegtsvetkov/yii2-sentry.
This plugin requires Craft CMS 3.1.0 or later.
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require robuust/craft-sentry-log-target
-
In the Control Panel, go to Settings → Plugins and click the “Install” button for Sentry Log Target.
Create a config/sentry-log-target.php
config file with the following contents:
<?php
return [
'*' => [
'dsn' => '$SENTRY_DSN' ?: 'https://[email protected]/123456789', // Set as string or use environment variable.
'sentrySettings' => [], // Use options from Sentry PHP SDK as-is.
'levels' => ['error', 'warning'],
'except' => ['yii\web\HttpException:40*'],
],
];