Lookout
000 015 030 045 060 075 090 105 120 135 150 165 180 195 210 225 240 255 270 285 300 315 330 345 360
6 min read Tom Shafer

Laravel error tracking: a complete guide

What to track in a Laravel app, how Laravel surfaces errors, how to set up tracking in one line, and how to keep alerts useful — a practical guide.

Most Laravel apps learn they're broken the worst way: a customer email, or a 2 a.m. page for the hundredth identical exception while the one that matters scrolls past. Error tracking is how you flip that around — catch problems from your own dashboard, grouped and traced, before anyone outside the team notices.

This is a practical guide to doing it well on Laravel specifically: what's worth capturing, how Laravel surfaces errors under the hood, how to wire up tracking in about two minutes, and how to keep the signal high. I build Lookout, so I'll use it for the concrete examples — but most of this applies whatever tool you choose.

What "error tracking" actually means

Error tracking is more than writing exceptions to a log file. A real error tracker:

  • Captures every unhandled exception with its stack trace, request context, and environment.
  • Groups thousands of occurrences of the same bug into one issue, so volume becomes a number instead of a wall of noise.
  • Alerts the right person when something new or spiking happens — and stays quiet otherwise.
  • Traces the slow and wasteful paths (N+1 queries, slow queries) that aren't exceptions but still hurt.

The log file does the first job, badly, and none of the rest. The whole point of a tracker is turning raw error volume into a short, ranked list of things actually worth your attention.

How Laravel surfaces errors

Laravel funnels every uncaught exception through its exception handler (App\Exceptions\Handler, or the withExceptions hook in bootstrap/app.php on newer apps). The handler has two jobs: report (log it / send it somewhere) and render (turn it into an HTTP response). Error tracking hooks the report side — every reportable exception is an event you want captured, before Laravel renders a 500 to the user.

That's why a good Laravel integration is more than a try/catch: it observes the framework's own error pipeline, plus the things Laravel does that aren't exceptions at all — database queries, queued jobs, view rendering, outbound HTTP. If you want the mechanics of reading those captured traces, see reading PHP stack traces.

What's worth tracking in a Laravel app

Exceptions are table stakes. The framework-specific wins are the rest:

  • Unhandled exceptions — grouped by fingerprint, with stack trace, request URL, and context.
  • N+1 queries — the single most common Laravel performance bug. A loop that lazily loads a relation turns one page into dozens of queries. See finding N+1 queries in Laravel.
  • Slow queries — the query that's fine on your laptop and miserable on production data. Covered alongside tracing Blade views and slow queries.
  • Queued jobs — failures in background work that never render a response, so nobody sees them fail.
  • Blade views and outbound HTTP — where the request actually spends its time.

A tracker that understands these is doing Laravel error tracking, not generic error tracking pointed at a Laravel app.

Setting it up (about two minutes)

The whole point is that this shouldn't be a project. With Lookout it's two commands and an env value:

composer require lookout/tracing
php artisan lookout:install

Paste your project API key into .env, throw a test exception, and watch it land — grouped, traced, and waiting for you. Because ingest is plain HTTP/JSON, there's no agent or sidecar to run. The full walkthrough is in add error tracking to a Laravel app in two minutes.

Grouping: turning a flood into a list

The feature that makes error tracking usable is grouping. When the same exception fires ten thousand times, you want one issue with a count of ten thousand — not ten thousand rows. Fingerprint grouping does this by hashing the exception's identity (class, message shape, location) so duplicates collapse automatically, and you can still drill into any single occurrence when you need the exact request that triggered it.

Get grouping right and your error list becomes short and ranked. Get it wrong and a tracker is just a more expensive log file.

Alerting without the noise

The fastest way to make a team ignore error tracking is to page them for everything. Good alerting is about thresholds and windows, not per-event firing: an alert that triggers when a group crosses N occurrences in a 1h or 24h window catches real spikes and stays silent for the steady background hum. The goal is to wake the right person once, not the whole team every time. I wrote up the philosophy and the mechanics in alerts that wake the right person.

Don't forget the rest of your stack

Laravel is rarely alone. The moment you add a Node frontend, a Rails service, a WordPress marketing site, or a mobile app, you don't want a second tool and a second dashboard. A tracker with a plain-HTTP ingest contract covers all of them from one project — more on that in error tracking for multi-stack teams.

Choosing a tool

There's no single right answer — it depends on how you ship. A few honest comparisons to shortcut the research:

The reliable way to decide is to run the same week of real production errors through whichever two you're torn between, and pick with your own data.

The short version

Error tracking on Laravel is worth doing properly: capture every exception, group the flood into a ranked list, trace the N+1 and slow queries that logs never show you, and alert on thresholds so the noise stays low. It should take minutes to set up, not a sprint.

Spin up a free Lookout project — 10,000 events a month, no credit card — and have your first real error grouped, traced, and waiting for you instead of your customers.

laravel error-tracking observability guide