Skip to content

Instantly share code, notes, and snippets.

@hallindavid
Created December 20, 2020 17:24
Show Gist options
  • Save hallindavid/27fd0f361674a9125781c5fb99990635 to your computer and use it in GitHub Desktop.
Save hallindavid/27fd0f361674a9125781c5fb99990635 to your computer and use it in GitHub Desktop.
logs:clear artisan command for Laravel
Artisan::command('logs:clear', function () {
exec('rm ' . storage_path('logs/*.log'));
$this->comment('Logs have been cleared!');
})->describe('Clear log files');
@hallindavid
Copy link
Author

Blatantly stolen from https://stackoverflow.com/questions/28127495/in-phps-laravel-how-do-i-clear-laravel-log

Drop this in routes/console.php and you're good to do

php artisan logs:clear

to clear all your logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment