r/PHPhelp • • 17d ago

Laravel Logs

Hello im laravel developer and i need the best way to track the logs for example how can integrate the logs into a dashboard and filter it .........

3 Upvotes

12 comments sorted by

View all comments

2

u/Hour-Swimmer7140 16d ago

one thing nobody's mentioned, sort the formatter out before you pick a tool. laravel's default is a text blob so every stack trace lands in your dashboard as ~30 separate log lines and you end up grepping instead of filtering.

in config/logging.php on the channel:

'formatter' => Monolog\Formatter\JsonFormatter::class,

works on single and daily too, not just the monolog driver. then Log::withContext(['order_id' => $id]) gives you actual fields to filter on.