CakePHP-Sentry
A CakePHP plugin to send errors/exceptions/logs to Sentry (getsentry.com) https://www.getsentry.com
Installation
- Clone the files into
app/Plugin/Sentry
(remember to also get the PHP Raven submodule -gitsubmodule init
thengit submodule update
) - Load the plugin in
app/Config/bootstrap.php
by callingCakePlugin::load('Sentry');
- Setup the plugin as the Error/Exception handler in
app/Config/core.php
App::uses('SentryErrorHandler', 'Sentry.Lib');
Configure::write('Error', array(
'handler' => 'SentryErrorHandler::handleError',
'level' => E_ALL & ~E_DEPRECATED,
'trace' => true
));
Configure::write('Exception', array(
'handler' => 'SentryErrorHandler::handleException',
'renderer' => 'ExceptionRenderer',
'log' => true
));
- Place your settings in
app/Config/core.php
Configure::write('Sentry', array(
'DSN' => array(
// Your private Sentry DSN
'PHP' => 'http://123456@sentry.com/1'
),
// Configuration for the Sentry user interface - will display a CakePHP logged in user
'user' => array(
// Change the model used for the CakePHP user
'model' => 'CustomUser',
// Map the fields sent by Sentry to custom fields on the user model
'fieldMapping' => array(
'username' => 'custom_username',
'email' => 'custom_email'
)
),
'ignoredExceptions' => array('NotFoundException'),
// Treat any Errors captured in Sentry as warnings
'treatErrorAsWarning' => true
));