jeudi 26 août 2021

When and how do Laravel daily logging files get deleted?

I'm running Laravel 5.8 and using the built-in Laravel Log functionality. And I've created a few custom logs.

I set each of them to store the daily log files for 30 days, like so:

'reconciliation' => [
    'driver' => 'daily',
    'path' => storage_path('logs/reconciliation/reconciliation.log'),
    'days' => 30
]

However, the logs don't stay for 30 days, like I've set them to. They stay for 7. I've heard that there is another configuration called log_max_files, which might be what I'm looking for. But all the references to log_max_files are from Laravel 5.4 and below. And I know that the logging functionality was revamped in 5.6. So I'm not sure if log_max_files even works anymore and I'd like to test it.

I've created a new log file with a date far outside the current 7-day range and I want to confirm that it gets deleted when the logs get cleared.

I'm just not sure when Laravel clears out the old logs. I couldn't find any in-depth information like that in the docs and my Google searching hasn't turned anything up.

I've tried restarting my server, running php artisan config:clear and php artisan cache:clear with no luck.

Does anyone actually know the process by which these log files get deleted and when that process runs?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire