Created
April 30, 2014 08:00
-
-
Save bwaidelich/bda3dfd13eb3609a8ace to your computer and use it in GitHub Desktop.
Using Sentry for tracking errors in TYPO3 Flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "your/package", | |
"type": "typo3-flow-package", | |
// ... | |
"require": { | |
"raven/raven": "*" | |
}, | |
// ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Your\Package\Error; | |
/* * | |
* This script belongs to the TYPO3 Flow package "Your.Package". * | |
* * | |
* */ | |
use TYPO3\Flow\Error\ProductionExceptionHandler; | |
/** | |
* Production Exception handler that reports exceptions to a configurable Sentry DSN using the raven library | |
*/ | |
class SentryExceptionHandler extends ProductionExceptionHandler { | |
/** | |
* @param \Exception $exception | |
* @return void | |
*/ | |
protected function echoExceptionWeb(\Exception $exception) { | |
if (isset($this->options['sentryDsn']) && strlen($this->options['sentryDsn']) > 0) { | |
$ravenClient = new \Raven_Client($this->options['sentryDsn']); | |
$ravenClient->captureException($exception); | |
} | |
parent::echoExceptionWeb($exception); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TYPO3: | |
Flow: | |
error: | |
exceptionHandler: | |
className: 'Your\Package\Error\SentryExceptionHandler' | |
# Sentry DSN (e.g. "http://public:secret@example.com/1") | |
'sentryDsn': '' |
the excludeClasses setting has no effect. only "composer install -o" works
FYI: I still have the autoloading issue on Flow master (3.0). It can be worked around by including the raven autoloader explicitly:
include_once Files::concatenatePaths(array(FLOW_PATH_PACKAGES, 'Libraries/raven/raven/lib/Raven/Autoloader.php'));
\Raven_Autoloader::register();
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
FYI via twitter: