How to fix `laravel recent daily log file has been deleted`

1.6k Views Asked by At

I use laravel 5.4 and daily logs for log error. But sometimes the current log is deleted and laravel generates this error:The stream or file "/storage/logs/laravel-2019-09-06.log" could not be opened: failed to open stream: Permission denied but the file has been already created.

I create manually the log file and put this permission chmod 775 -R to storage directory but it gets lost anyway.

2

There are 2 best solutions below

0
Sourazou Soury Bountoulgou On BEST ANSWER

I asked the same question about https://laracasts.comand we were able to solve the problem.

Find the solution here:

https://laracasts.com/discuss/channels/laravel/how-to-fix-laravel-recent-daily-log-file-has-been-deleted

1
M.Santos On

I imagine your operating system is Linux. I use Linux fedora and already had a similar error. What worked for me was to delete the logs folder, I used chmod 777 -R / folder name. Give a clean because usually some garbage is stored. Use: php artisan config: clear

php artisan confi: cache

php artisan route: clear

php artisan view: clear

and finally use: Composer install and then Composer update.

I believe this will solve !!