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

Laravel Json Context Logging Laravel Package

czim/laravel-json-context-logging

A Laravel logging package that adds structured JSON context to log entries, helping you attach request, user, and custom data consistently for easier debugging, filtering, and search across application logs.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit: The package targets a real architectural gap — Laravel's default single-line log output is hard to query, and structured context (request ID, tenant, user, trace ID) is what makes logs usable in an aggregator. Its design (configurable processors enriching records, a custom logger factory, driver integration into config/logging.php) is the right shape for Laravel's channel/handler/formatter/processor pipeline. But the shape is right for 2019's pipeline. Laravel has since moved to Monolog 2 then 3, added native JsonFormatter support in channel config, and shipped first-class context APIs (Log::withContext(), the Context facade). The package's differentiator has been absorbed by the framework.

Integration feasibility: Low for a current stack. The last release is 2019-03-05, predating PHP 8, Laravel 7 through 12, and Monolog 2/3 — which added type declarations and removed legacy formatter/handler APIs a package of this vintage would compile against. Expect either a Composer constraint failure (fails fast, which is the good outcome) or an install that succeeds and then throws at runtime on a Monolog interface mismatch (the bad outcome). There is no evidence of Laravel/PHP version support beyond the 2019 matrix.

Technical risk: High, and the risk is concentration rather than severity. Three stars and zero dependents means no downstream usage to surface bugs, no community patches, no one to escalate to. An abandoned dependency in a cross-cutting path like logging is a permanent ownership transfer to us. Secondary risks: log formatters process user-controlled data, so without maintained redaction support we inherit log-injection and PII-leakage exposure in whatever the package serializes into context; and format drift is silent — a broken formatter can degrade observability without failing a request.

Key questions:

  • Does the declared Composer constraint accept our PHP and laravel/framework versions, or does it fail at install? (Run this first — it is a 10-minute answer that gates everything else.)
  • Which capabilities do we actually need that Monolog's native JsonFormatter plus a context middleware cannot deliver in under ~50 lines?
  • Is this being considered as a dependency or as prior art for an internal logging standard? These are different decisions with different risk budgets.
  • If adopted, who owns the fork when a CVE or a Laravel 13 break lands, and what is the response SLA?
  • Do any compliance, audit, or customer-contract obligations attach to these logs? If yes, an unmaintained formatter is disqualified.
  • What is in context — could it capture tokens, cookies, or PII by default?

Integration Approach

Stack fit: Fits only Laravel applications that (a) are pinned to a 2019-era framework, or (b) accept a vendored fork. For a modern service, the fit is conceptual: the processor-enrichment pattern is worth copying, the package is not worth depending on.

Migration path: Two viable routes, and I would not choose a third.

  1. Native reimplementation (recommended). Configure a JSON channel using Monolog's built-in JsonFormatter via 'formatter' => Monolog\Formatter\JsonFormatter::class, add a middleware or Log::withContext() call to attach request ID / tenant / user, and add processors for host and environment. This is a config change plus a small middleware — days, not weeks — with zero new dependency and full upgrade safety.
  2. Vendor/fork (only if a specific processor is genuinely hard to reproduce). Copy the logic into an internal package we own, with tests. This preserves the capability while converting an unowned supply-chain risk into owned code.

Compatibility: Verify PHP and Laravel constraints before anything else; then check for Monolog 2/3 interface changes; then check whether our log aggregator (ELK, Datadog, CloudWatch) parses the exact field names the package emits. Field naming is the quiet migration cost — downstream dashboards and saved searches break on rename.

Sequencing:

  1. Confirm install feasibility against current PHP/Laravel — this single check may end the evaluation.
  2. Inventory existing logging config across Laravel services and enumerate what context fields we actually need.
  3. Prototype the native JSON-formatter-plus-middleware approach in one non-critical service; compare output field-by-field against the package's format.
  4. If the prototype meets requirements, retire the package question and schedule a standardization rollout.
  5. If not, scope the fork explicitly with an owner and a maintenance budget.
  6. Validate parsing in the log aggregator before any production cutover.

Operational Impact

Maintenance: This is the deciding factor. The package is inert — no releases in six-plus years, no triage, no security response. Every future Laravel or Monolog upgrade becomes our problem to solve. Adopting it converts a trivial config decision into a standing dependency liability that we carry indefinitely for a capability the framework now provides free.

Support: No upstream support channel. Internal support burden falls on whoever owns observability, and that person must be able to debug formatter and processor behavior in the logging hot path — a specialist skill, not a generalist one. With a native implementation, the support surface is Laravel's own documented logging pipeline.

Scaling: No meaningful throughput concern. Logging volume is bounded by channel config, sampling, and sink capacity, not by this package. The real scaling question is whether enrichment adds per-record overhead in the hot path — negligible for simple context, worth measuring if processors do I/O or serialization of large objects.

Failure modes:

  • Silent degradation: a formatter exception swallowed by the logging layer produces missing or malformed lines; nothing pages, and you discover it during an incident — the worst possible time.
  • Install-time constraint failure: benign; caught in CI.
  • Runtime Monolog interface mismatch: surfaces on first log write, potentially in production if logging paths are not exercised in tests.
  • Aggregator parse breakage: downstream dashboards and alerts go dark without an application error.
  • Context leakage: unredacted sensitive fields written to durable storage, which is a compliance incident rather than an engineering one.

Ramp-up: Near zero for the native approach — any Laravel developer can read config/logging.php and a middleware. For the package, ramp-up is deceptively easy and then steep: the initial config is simple, but understanding what the processors do, what they serialize, and why a formatter broke after a framework bump requires reading unmaintained source. The honest framing for stakeholders: this package's best use is as a reference design for an internal logging standard, not as a dependency. Given a 3-star, zero-dependent, seven-year-stale footprint in a cross-cutting path, the recommendation is to harvest the pattern and implement it natively — the cost is small, the exit path is immediate, and we avoid accruing dependency debt for a problem Laravel already solves.

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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource