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 ?
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With