Deleting a log file that is currently in used can be fatal. In my case it caused my artisan service to crash. It would be better if the log file was blanked instead of deleted.
php[591]: PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/laravel/storage/logs/laravel-2017-07-18.log" could not be opened: failed to open stream
I think Laravel creates a new one if it doesn't exists, right?
It may do such a check on first run. It is not doing such a check if it is deleted while artisan is accessing it.
Ok, thank you for contributing! I'm sorry about that crash! (and sorry for my late answer).
IMO, blanking the file is a bit weird (as a user you asked for "deleteting", and it just blanked something). And it will polluate the list of file on the left menu. Still, I understand your need. So I don't know what to do... Any thought?
You can blank the log file if it is the current day. Crashing servers is worse than weird behaviour. The weird behaviour can be justified in documentation.
May I suggest a new button that will save/rename the old log file and start a new one (create a blank file)? That would be great for backup purposes.
Fixed via https://github.com/rap2hpoutre/laravel-log-viewer/pull/141
Thanks @dobrik!
Available in v0.17.0
Most helpful comment
May I suggest a new button that will save/rename the old log file and start a new one (create a blank file)? That would be great for backup purposes.