Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set Log rotate in laravel?

Right now I'm using a single log file, but there is requirement to make it daily , but for the current date, the file name must be laravel.log

laravel-2020-08-30.log
laravel-2020-08-31.log
laravel-202-009-01.log  -> the current date must be laravel.log

`

Is it possible to get the logs daily, but named like this?

laravel.log

While the older (up to a week) are named like this:

laravel-2020-08-30.log

like image 948
ezles88 Avatar asked Sep 17 '25 12:09

ezles88


1 Answers

You can try given solution for you problem.

Update your .env file.

LOG_CHANNEL=daily

then you can run following this command on your terminal inside project root directory.

php artisan config:clear && php artisan cache:clear && php artisan config:cache

Now you can check your storage folder inside logs directory with following name conversion.

For ex: laravel-2020-09-01.log

like image 112
NikuNj Rathod Avatar answered Sep 20 '25 03:09

NikuNj Rathod