I actually found help here: https://stackoverflow.com/questions/50305186/custom-dynamic-log-file-names-with-laravel5-6
'channels' => [ 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', ], 'web' => [ 'driver' => 'single', 'path' => storage_path('logs/web/web.log'), ], ]
Then when you want to change it:
config(['logging.channels.web.path' => storage_path('logs/web/'.time().'.log')]);
Hi. I'm using Laravel 5.7, and I've got a number of classes which are run from the console (using the artisan command). I'd really like each instance of each class to log to a separate file, but using a filename which is set from the class.
I could create loads of log channels in config/logging.php, but that would still only create a log file per class, not per instance. Instead I'd really like to pass the filename in, either in the class constructor or in the actual log command.
Is this possible? Thank you!