Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sentry Monolog Adapter Laravel Package

macpaw/sentry-monolog-adapter

A Monolog handler that forwards log records to Sentry as events and breadcrumbs, making it easy to capture errors and context from Laravel and PHP applications. Configurable log levels and simple integration with existing logging stacks.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • The package is a thin bridge that converts Monolog LogRecords into Sentry Events and calls captureEvent on a Sentry ClientInterface/HubInterface. It exists to fill the gap left when sentry/sentry removed Sentry\Monolog\Handler from the core SDK — a real, structural gap, not a cosmetic one.
  • In a Laravel codebase this competes directly with the handler that sentry/sentry-laravel ships and wires up in its service provider. For a standard Laravel app, adopting this package is a replacement of a working, vendor-maintained component, not an addition.
  • Genuine fit is narrower than the description implies: framework-agnostic or non-Laravel services (queue consumers, CLI workers, shared internal packages) that want Sentry logging without pulling in a framework integration, or teams that need custom record→event mapping the official handler doesn't expose.
  • The description says "Symfony," the code is effectively framework-agnostic. Treat that mismatch as a signal: the package was extracted from MacPaw's Symfony stack, and Laravel-specific semantics (report filtering, Octane lifecycle, queue-worker context) were likely never design targets.

Integration Feasibility

  • Mechanically simple. Laravel's monolog log driver supports handler / handler_with and a via factory in config/logging.php, so registering a custom handler is a config change plus a small service provider binding for the Sentry client dependency. No middleware, no facade, no interception layer.
  • Low integration cost, high validation cost: the handler receives the same records Laravel already routes to Sentry, so the only way to know the swap is behaviorally equivalent is to diff event payloads in staging.

Technical Risk

  • Maturity risk dominates. 25 stars, 0 dependents, single-vendor origin. That is not a disqualifier for a ~200-line adapter, but it means the project has no downstream gravity — breakage will not be reported by anyone but you.
  • Compatibility risk is concentrated and predictable: the package must track both Monolog 3.x and Sentry SDK 4.x/5.x. The very event that created this package will recur at the next Sentry major. Verify pinned constraints before anything else.
  • Supply-chain review cost (license, provenance, CI, release signing) is likely to exceed the cost of authoring an equivalent handler in-house.
  • Behavioral regression risk against sentry/sentry-laravel: report-filtering of exceptions is a first-class Laravel feature. A generic adapter has no knowledge of it and will happily ship exceptions you deliberately excluded.

Key Questions

  • Declared constraints for monolog/monolog, sentry/sentry, and PHP version? Monolog 3 and Sentry 4+ supported explicitly, or by accident?
  • What is the exact record→event mapping: is context promoted to extra, is exception attached as Throwable, are channel/level preserved as tags, is extra filtered before serialization?
  • Does it expose an isHandling() gate so LOG_LEVEL and channel-level filtering still short-circuit before Sentry work is done?
  • Does it implement reset() / close() correctly for long-running processes (Octane, Horizon, queue:work)?
  • Is transport synchronous? Is there buffering/spooling, or does a Sentry API stall block the request?
  • Is there any suppression of handler-thrown exceptions, or can a Sentry failure break application logging?
  • Release cadence and maintenance ownership — commit history since the 2025-08 release, and is it responding to Sentry SDK majors?

Integration Approach

Stack fit

  • Only justified when one of these holds: (a) you are on Sentry SDK 4+ without sentry/sentry-laravel; (b) you maintain a shared package that must log to Sentry without a framework dependency; (c) you need payload control the official handler doesn't give you. If none hold, the correct decision is to stay on sentry/sentry-laravel and close the evaluation.
  • Highest-value internal use case is (b): a domain package used by both a Laravel app and standalone workers. One adapter reused across both is a real consistency win.

Migration path

  • Do not swap the global logging stack first. Start by registering the adapter as an additional channel (stack → sentry_adapter) alongside the existing Sentry integration, so both emit in parallel.
  • Diff captured events between the two channels for a defined window (one to two weeks of staging plus a low-traffic production slice). Compare: event count per exception class, presence of extra/context, breadcrumb fidelity, and — critically — the list of exception classes that reach Sentry versus the ones Laravel's report filter intends to suppress.
  • Only remove the incumbent handler once the delta is understood and accepted. If the delta is zero, the migration bought nothing; that is a legitimate reason to roll back to the vendor-supported path.

Compatibility

  • Verify against the exact Laravel version in use, since Laravel pins Monolog per major (10/11/12 → Monolog 3). A package that only supports Monolog 2 is a non-starter and should be rejected at triage.
  • Confirm handler_with / via instantiation works with the adapter's constructor — if it requires a pre-built HubInterface, you need a singleton binding in a service provider; if it accepts config only, config alone suffices.
  • Octane compatibility is the sharp edge: verify reset() clears breadcrumbs and any accumulated context between requests, otherwise you leak request data across requests in the same worker.

Sequencing

  1. Triage: read composer.json constraints and the record→event mapping. Reject early if Monolog 3 / Sentry 4 are not explicitly supported.
  2. Build-vs-buy: estimate in-house handler (~1–2 engineer-days including tests). If the estimate is under the supply-chain review overhead, write it internally.
  3. Shadow-mode deployment on one non-critical service, dual-emitting with the incumbent.
  4. Automated assertion that a test exception produces exactly one Sentry event with expected extra keys — run in CI against the Sentry test transport, not production.
  5. Controlled rollout by service, with the incumbent handler kept as a config-toggle rollback for one release cycle.

Operational Impact

Maintenance

  • You are adopting an adapter whose entire purpose is to absorb an upstream breaking change, in a project with no downstream users to detect the next one. Budget a recurring line item: re-verify on every Sentry SDK major and every Monolog major. Realistically one short spike per year, plus a hard failure if you upgrade Sentry without checking.
  • Pin exact versions. Do not float ^ on this dependency. Add a dependency-bot rule that flags Sentry/Monolog bumps as requiring manual review rather than auto-merge.

Support

  • No community to lean on. Internal documentation must record why this package exists, because in twelve months it will look like an unexplained duplicate of the vendor handler and someone will "clean it up."
  • Escalation path is upstream GitHub issues against a 25-star repo, or fork-and-patch. Confirm legal/procurement is comfortable with the MIT fork-and-maintain fallback before adoption, not after.

Scaling

  • Watch long-lived processes: Horizon workers and Octane accumulate breadcrumbs and context in memory across jobs unless reset() is called. Under load this is a slow leak, not a crash — it will surface as rising RSS weeks later.
  • Synchronous transport is the throughput risk: the default Sentry transport makes an outbound HTTPS call on the request path. Verify buffering/spooling or set a short timeout, otherwise a Sentry degradation becomes a latency incident correlated with your error rate — the worst possible time.
  • Volume amplification: verify isHandling() gates before captureEvent, or every Log::debug in a hot loop becomes an event-construction cost even if Sentry drops it.

Failure modes

  • Handler exception propagates into the logging pipeline and breaks the request — must be contained; test by pointing the DSN at an unreachable host.
  • Report-filter regression: exceptions on the dontReport list start arriving in Sentry, inflating quota and burying real signal.
  • PII leakage: generic adapters typically forward context/extra wholesale; Laravel apps commonly put user IDs, emails, and request bodies in log context. Audit against the DSN's data-scrubbing rules before enabling in production.
  • Silent no-op after an SDK upgrade — no error, no events, discovered during the next incident. Mitigate with a synthetic canary event emitted on a schedule and alerted on absence.
  • Breadcrumb cross-contamination in Octane: request A's context visible in request B's captured event.

Ramp-up

  • Engineer ramp-up is trivial — one afternoon to read the handler and wire the channel.
  • Organizational ramp-up is the real cost: the decision runs against the default (use the vendor integration) and therefore needs a written justification that survives review. If the justification is not "framework-agnostic reuse" or "payload control we cannot get otherwise," the assessment should recommend declining and standardizing on sentry/sentry-laravel.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast