Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excluding log types from e-mail target does not work #1461

Closed
basil-inc opened this issue Dec 8, 2013 · 1 comment
Closed

Excluding log types from e-mail target does not work #1461

basil-inc opened this issue Dec 8, 2013 · 1 comment

Comments

@basil-inc
Copy link
Contributor

I have set up email logging for everything except 404 errors (since these would be far too common). However, I just got an e-mail with such a log.

This is the configuration in the app's params:

        'components.log' => [
                'traceLevel' => 0,
                'targets' => [
                        'file' => [
                                'class' => 'yii\log\FileTarget',
                                'levels' => ['error', 'warning'],
                        ],
                        'email' => [
                                'class' => 'yii\log\EmailTarget',
                                'except' => ['yii\web\HttpException\404'],
                                'levels' => ['error', 'warning'],
                                'message' => ['from' => 'webmaster@mydomain.com', 'to' => 'webmaster@mydomain.com'],
                        ],
                ],
        ]

This is the e-mail I got (apparently some random bot snooping around for a non-existing admin/config.php file):

2013/12/08 21:52:44 [24.11.249.140] [error]
[yii\web\HttpException:404] exception 'yii\base\InvalidRouteException'
with message 'Unable to resolve the request "admin/config.php".' in
/var/www/vendor/yiisoft/yii2/yii/base/Module.php:590
Stack trace:
#0
/var/www/vendor/yiisoft/yii2/yii/web/Application.php(77):
yii\base\Module->runAction('admin/config.ph...', Array)
#1
/var/www/vendor/yiisoft/yii2/yii/base/Application.php(289):
yii\web\Application->handleRequest(Object(yii\web\Request))
#2
/var/www/backend/web/index.php(25):
yii\base\Application->run()
#3 {main}

Next exception 'yii\web\NotFoundHttpException' with message 'Unable to
resolve the request "admin/config.php".' in
/var/www/vendor/yiisoft/yii2/yii/web/Application.php:88
Stack trace:
#0
/var/www/vendor/yiisoft/yii2/yii/base/Application.php(289):
yii\web\Application->handleRequest(Object(yii\web\Request))
#1
/var/www/backend/web/index.php(25):
yii\base\Application->run()
#2 {main}
2013/12/08 21:52:44 [24.11.249.140] [error]
[yii\i18n\PhpMessageSource::loadMessages] The message file for
category 'app' does not exist:
/var/www/common/messages/en-US/app.php
2013/12/08 21:52:44 [24.11.249.140] [info] [application] $_SESSION =
array (
  '__flash' =>
  array (
  ),
)
@qiangxue
Copy link
Member

qiangxue commented Dec 8, 2013

except should set as ['yii\web\HttpException:404'] instead ['yii\web\HttpException\404'].

@qiangxue qiangxue closed this as completed Dec 8, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant