Rock Rathore
Rock Rathore

Reputation: 395

Where should i look for Yii2 log exception file

A beginner to Yii 2 framework, can anyone please tell me where do i find the log exception file or if have to create the file to store all exceptions then how should i create one ?

Upvotes: 3

Views: 10990

Answers (2)

user5201742
user5201742

Reputation:

If you're are using the Advanced Application Template, each app (frontend, backend) has his own runtime/logs folder with a log file.

Also, you can add in config file this setting, for components, to receive and email every time a level of error you've set, occurs:

'log' => [
            'targets' => [
                'email' => [
                    'class' => 'yii\log\EmailTarget',
                    'levels' => ['error'],
                    'message' => [
                        'from' => 'app-email', 
                        'to' => 'your-email',
                        'subject' => 'Log message',
                    ],
                ],
            ],
        ],

Very useful for production.

Upvotes: 3

mcserep
mcserep

Reputation: 3299

By default, Yii2 logs error and warning level events into the runtime/logs/app.log file. You can read more about configuring logging in Yii2 in e.g. the Definitive Guide.

Upvotes: 6

Related Questions