Nov 15, 2024
0
Level 1
How to turn off Laravel Context append data for logging
I'm use Laravel Context feature in app (v11.x > Docs > Digging Deeper > Context). And I want to turn off append metadata for Log instance (LoggerInterface) on $debug = false;, and turn on on $debug = true;
I tried create instance without context — Log::withoutContext()->channel('dns');
It's not help.
I found point where Laravel add Context data to log record - Illuminate\Log\LogManager->get():
return $record->with(extra: [
...$record->extra,
...$this->app[ContextRepository::class]->all(),
]);
But I didn't see options to turn off context in this class.
Laravel Framework 11.30.0
Please or to participate in this conversation.