In the version of Laravel 5.6 that I am using, the configuration file for logging is config/logging.php
There you will find the following section
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
...
]
Change the line
'channels' => ['single'],
into
'channels' => ['daily'],
Then it will be like:
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['daily'],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'debug',
'days' => 7,
],
...
]
It will create log files for each day in the format laravel-2018-08-13.log
in the logs directory.
The log directory will be like
Previously
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/EZvuY.png)
After applying rotation configuration the directory is having the log file created for the current date (as circled one which is created for today 2018-08-13).
![enter image description here](https://cdn.statically.io/img/i.sstatic.net/c3yc3.png)