Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

realtebo's avatar

Log: can we send some logs to a specific new file?

We are in the middle of a storm and we would like to separate some logs from others.

Is there a way in Laravel to send 'some' logs to a different log file using an attribute, a special syntax, a regexp, whatelse .. !?=

0 likes
1 reply
NicolasMica's avatar

You may add another channel in the config/logging.php file.

// config/logging.php
'channels' => [
	// ...
    'storm' => [
        'driver' => 'single',
        'path' => storage_path('logs/custom-log-file.log'),
	],
],

Then simply use that channel when needed (docs).

use Illuminate\Support\Facades\Log;

Log::channel('storm')->info(...);
1 like

Please or to participate in this conversation.