I
I
Ilya Beloborodov2017-02-11 18:53:20
Yii
Ilya Beloborodov, 2017-02-11 18:53:20

Yii\log\EmailTarget, all errors except 404?

Actually, the question in the title is how to make sure that all errors except 404 are sent to the mail?
My, quite standard config

'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
                [
                    'class' => 'yii\log\EmailTarget',
                    'mailer' => 'mailer',
                    'levels' => ['error', 'warning'],
                    'message' => [
                        'from' => ['[email protected]'],
                        'to' => ['[email protected]'],
                        'subject' => 'Log message',
                    ],
                ],
            ],
        ],

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
padlyuck, 2017-02-11
@kowap

...
'email' => [
                    'class' => EmailTarget::class,
...
                    'except' => [
                        'yii\web\HttpException:404',
                    ],
                ],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question