Exception logging with Sentry
$ composer require networkteam/sentry-client
It's also available in TER.
// Extension Configuration
$GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sentry_client']['dsn'] = 'http://public_key@your-sentry-server.com/project-id';
// LocalConfiguration.php (New since 3.0!!!)
$GLOBALS['TYPO3_CONF_VARS']['SYS']['productionExceptionHandler'] = 'Networkteam\SentryClient\ProductionExceptionHandler';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['debugExceptionHandler'] = 'Networkteam\SentryClient\DebugExceptionHandler';
The new Sentry SDK 2.x has some environment variables which can be used, for example in a .htaccess file:
SetEnv SENTRY_DSN http://public_key@your-sentry-server.com/project-id
SetEnv SENTRY_RELEASE 1.0.7
SetEnv SENTRY_ENVIRONMENT Staging
- Ignore PageNotFoundException and trigger 404 handling instead
- Ignore database connection errors (they should better be handled by a monitoring system)
- Report user information: Select one of
none
|userid
|usernameandemail
- Blacklist exception message regular expression
page = PAGE
page.20 = USER
page.20 {
userFunc = \Networkteam\SentryClient\Client->captureException
}
This triggers an exception which will be reported.
This extension is managed on GitHub. Feel free to get in touch at https://github.com/networkteam/sentry_client
There is a Slack channel #ext-sentry_client
- Use sentry/sdk:2.0
- Remove setting productionOnly
- Remove setting reportWithDevIP
- Rename setting activatePageNotFoundHandlingActive to activatePageNotFoundHandling
- Report E_ALL ^ E_NOTICE
- Strip project root
- Show event id in FE