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 today

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 66% of packages

Maintenance26

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

1732d 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.9k247.1M330](/packages/sentry-sentry)[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k373.5M3.3k](/packages/symfony-cache)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[illuminate/log

The Illuminate Log package.

6225.3M619](/packages/illuminate-log)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k14](/packages/tempest-framework)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k49](/packages/ecotone-ecotone)

PHPackages © 2026

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