I'm using Laravel 7.x and I want to write my own logs. I've configured config/logging.php and achieved writing my log entries, but Laravel is also writing its own log entries in my log file.
How do I disable automatic Laravel log entries and keep my own log writing?
Thanks in advance.
You could make your own log channel. Edit your config/logging.php
:
....
'channels' => [
....
'your-channel-name' => [
'driver' => 'daily',
'path' => storage_path('logs/your-channel-log-file-name.log'),
'level' => 'debug'
],
],
....
After that you could make records to your-channel-log-file-name.log
file like this:
\Log::channel('your-channel-name')->debug('This is my debug message');
It's like using logger()
function.