Level 63
https://stackoverflow.com/questions/52117102/laravel-customize-log-formatter
Just looking at this post, perhaps (but not sure) this will work ?
'formatter_with' => [
'format' => 'Y-m-d', // format instead of dateFormat
]
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have in my logging.php this channel
'events' => [
'driver' => 'monolog',
'path' => storage_path('logs/events.log'),
'level' => 'info',
'formatter' => Monolog\Formatter\JsonFormatter::class,
'formatter_with' => [
'dateFormat' => 'Y-m-d',
]
]
if I try to log with
Log::channel('events')->info("my message");
the date format doesn't affects the json, so I always have datetime part in this format
"datetime":"2022-11-22T11:57:11.202195+01:00"
if I use the LineFormatter the date is formatted as I declare in dateFormat
Please or to participate in this conversation.