Every Laravel app catches exceptions. The question is whether anyone finds out about them. Unhandled errors land in a log file by default, which means they're technically recorded and practically invisible. Nobody reads laravel.log until something is already on fire. The whole job of exception tracking is to close the gap between "an error happened" and "a human knows," and to do it without burying the one new bug that matters under ten thousand copies of an old one. That second part (grouping) is what separates a tracker from a log file.
Baseline: the Log facade
By default, Laravel's exception handler writes unhandled exceptions to the configured log channel. Look in storage/logs/laravel.log or your configured driver (daily, papertrail, syslog, custom).
'stack' => [
'driver' => 'stack',
'channels' => ['daily', 'errorlog'],
'ignore_exceptions' => false,
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/laravel.log'),
'level' => 'error',
'days' => 14,
],This catches everything. Missing: grouping, trending, and anything that looks like a UI. Good enough for a side project, not for production.
Fan out with the Exceptions handler
In Laravel 11+, register reporters in bootstrap/app.php:
use App\Exceptions\CouponExpiredException;
use App\Exceptions\CustomBusinessException;
use Illuminate\Foundation\Configuration\Exceptions;
->withExceptions(function (Exceptions $exceptions) {
// Add deploy version to every logged exception
$exceptions->context(fn () => [
'release' => config('app.release_sha'),
'node' => gethostname(),
]);
// Skip exceptions you don't care about
$exceptions->dontReport([
CouponExpiredException::class,
]);
// Route custom exceptions to your tracker
$exceptions->report(function (CustomBusinessException $e) {
app('tracker')->capture($e, [
'order_id' => $e->orderId,
'severity' => 'business',
]);
});
})Enrich exceptions with user context
An exception stack without the user who hit it is half-useful. Nightwatch, which NightOwl reads, attaches the authenticated user to every exception it captures during a request, with no middleware needed. It stores the user's ID, name and username (by default the name and email columns). To choose what fills name and username, register a resolver once in AppServiceProvider::boot():
use Laravel\Nightwatch\Facades\Nightwatch;
public function boot(): void
{
Nightwatch::user(fn ($user) => [
'name' => $user->name,
'username' => $user->email,
]);
}Fingerprint and group
A busy production app can throw thousands of exceptions a day, and most are repeats of a few bugs. Fingerprinting rolls the repeats into one issue each.
A good fingerprint uses:
- Exception class (
QueryException) - The top app-level stack frame (skip vendor frames)
- In some trackers, a normalized message (dynamic values like IDs, emails and timestamps stripped)
Every production-grade tracker (NightOwl, Nightwatch Cloud, Sentry, Bugsnag, Flare, Rollbar) does this automatically; with raw logs you're grouping by hand with grep. NightOwl hashes the class, the exception code, and the file and line of the first non-vendor frame, separately per environment. The message isn't part of the fingerprint, so IDs or emails in it never split a group.
Silence the noise at the source
Laravel already keeps the most common noise out of reports. Its internal don't-report list covers HttpException (so 404s and 405s), ValidationException, AuthenticationException, AuthorizationException, TokenMismatchException (CSRF), ModelNotFoundException and HttpResponseException. What's left to suppress before it hits your tracker (to avoid billing costs and UI clutter) is your own expected exceptions:
use App\Exceptions\CouponExpiredException;
use App\Exceptions\PaymentDeclinedException;
$exceptions->dontReport([
CouponExpiredException::class, // expected, already shown to the user
]);
$exceptions->dontReportWhen(
fn (Throwable $e) => $e instanceof PaymentDeclinedException && $e->declinedByBank
);Alert on signal, not noise
Page on grouped signal, not per-occurrence. The alert matrix that works for most teams:
- First seen: any new fingerprint appearing in the last hour
- Spike: existing fingerprint's rate jumps 10x over baseline
- Threshold: more than N of fingerprint X in 15 minutes, where X is in a critical path
- Regression: fingerprint that was resolved reappears after a deploy
NightOwl covers first seen and regression: issue.new fires for a new fingerprint, and issue.reopened fires when a resolved issue occurs again.
Send all alerts to a Slack or Discord channel. Email is fine as a low-urgency fallback; never page on email.