laravellogging

Laravel logging to a custom channel


I am trying to log certain application processes into a log in Laravel. I created a log channel in logging.php

'report-log' => [
            'driver' => 'single',
            'path' => storage_path('logs/report-log.log'),
            'level' => 'debug',
        ],

Now I am using

Log::channel('report-log')->info('Something happened!');

This is not creating any log file(since the file is not present initially) or make any log entry.


Solution

  • I resolved my issue by creating a file 'report-log.log' under logs. It was automatically not getting created for me so I created it and the logs started appearing.