yii2-sentry
yii2-sentry copied to clipboard
How to ignore yii\web\NotFoundHttpException
Hi.
How to prevent yii\web\NotFoundHttpException
to be sended to Sentry?
Late reply but in case someone is looking for it too
Use 'except'
Like this
return [
'components' => [
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'notamedia\sentry\SentryTarget',
'dsn' => 'http://2682ybvhbs347:[email protected]/1',
'levels' => ['error', 'warning'],
'context' => true,
'clientOptions' => ['release' => '[email protected]'],
'except' => [
'yii\web\HttpException:404',
'yii\web\HttpException:400',
'yii\web\HttpException:403',
],
],
],
],
],
];
@Levii22 thanks!
I used this except code, but it's not working. I sentry there are still errors showing up "yii\web\NotFoundHttpException". I tried also just "NotFoundHttpException" with no success. Any ideas?
'except' => [
'yii\web\NotFoundHttpException',
'yii\web\ForbiddenHttpException'
],
I used this except code, but it's not working. I sentry there are still errors showing up "yii\web\NotFoundHttpException". I tried also just "NotFoundHttpException" with no success. Any ideas?
'except' => [ 'yii\web\NotFoundHttpException', 'yii\web\ForbiddenHttpException' ],
@kasoft Make sure you have it inside targets I'm using yii\web\HttpException:404 and yii\web\HttpException:403 and it seems to work fine. Try it
'except' => [
'yii\web\HttpException:404',
'yii\web\HttpException:403',
],
Thanks @Levii22 - seems to work. I was on the wrong track an thougt i put a Yii Path like "yii\web\NotFoundHttpException" in the list, but the working thing is "yii\web\HttpException:404"