PHPackages                             parli/json-logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. parli/json-logger

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

parli/json-logger
=================

PSR-3 JSON logger

1.0.1(4y ago)05.8k[3 PRs](https://github.com/Parli/json-logger-php/pulls)MITPHPPHP ^8.0

Since Oct 4Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Parli/json-logger-php)[ Packagist](https://packagist.org/packages/parli/json-logger)[ RSS](/packages/parli-json-logger/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (6)Used By (0)

`parli/json-logger`
===================

[](#parlijson-logger)

A PSR-3 JSON log formatter. This outputs a format designed around Datadog's logging system, using their [predefined attributes](https://docs.datadoghq.com/logs/log_configuration/attributes_naming_convention/#reserved-attributes) for the structure.

Usage
-----

[](#usage)

This library only formats logs, and does not write them. It must be used in conjunction with another PSR-3 which actually writes the logs somewhere useful. (For us, this is `stdout` due to deployment in a containerized environment.)

```
$writer = new \SomePsr3Logger();
$logger = new \Parli\JsonLogger\JsonLogger($writer);
// ...
$logger->error('Error message {info}', [
    'info' => $someMoreInfo,
    'exception' => $someThrowable,
]);
```

Note: the log writer will not receive the `$context` that this library receives. This library interpolates the context into the JSON message before passing a fully-formatted JSON string to the log writer.

Exception logging
-----------------

[](#exception-logging)

This library looks for `Throwable`s in the `exception` key of `$context`, per PSR-3 section 1.3. If found, it will automatically fill in the error attributes for integration with Datadog's log display system.

It is RECOMMENDED that you always pass caught exceptions to the logger's `$context` (e.g. `->error('...', ['exception' => $e])`). It is further RECOMMENDED that you *do not* do additional log interpolation.

Example:

```
try {
    // ...
} catch (Throwable $e) {
    $logger->error('Caught exception in worker with input {input}', [
        'input' => $input,
        'exception' => $e,
    ]);
}
```

COUNTEREXAMPLE:

```
// Do NOT do this:
try {
    // ...
} catch (Throwable $e) {
    $logger->error('Caught exception in worker with input {input} - {message}: {trace}', [
        'input' => $input,
        'message' => $e->getMessage(),
        'trace' => $e->getTraceAsString(),
        'exception' => $e,
    ]);
}
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1680d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/354842?v=4)[Eric Stern](/maintainers/Firehed)[@Firehed](https://github.com/Firehed)

---

Top Contributors

[![Firehed](https://avatars.githubusercontent.com/u/354842?v=4)](https://github.com/Firehed "Firehed (2 commits)")[![vpetro](https://avatars.githubusercontent.com/u/46123?v=4)](https://github.com/vpetro "vpetro (1 commits)")

---

Tags

librarylifesupportpipeline

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/parli-json-logger/health.svg)

```
[![Health](https://phpackages.com/badges/parli-json-logger/health.svg)](https://phpackages.com/packages/parli-json-logger)
```

###  Alternatives

[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M82](/packages/rollbar-rollbar)[illuminate/log

The Illuminate Log package.

6224.3M518](/packages/illuminate-log)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2222.9M248](/packages/open-telemetry-sdk)[open-telemetry/api

API for OpenTelemetry PHP.

1833.0M214](/packages/open-telemetry-api)[pagemachine/typo3-formlog

Form log for TYPO3

23225.3k6](/packages/pagemachine-typo3-formlog)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
