skillfed

logging-json

JSON formatter for python logging

logging-json v0.6.0 271.4K downloads/30d#8,222 on PyPI18
Permissive license MIT License Copyright (c) 2025 Colin Bounouar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) DORMANT released

What it is and what it does

logging-json is a formatter for Python's standard logging module that converts log records into JSON output. It sits between your application's logging calls and the output stream, intercepting records and serializing them as structured JSON dictionaries. This is particularly useful when your logs are consumed by centralized log aggregation systems like Splunk or Elasticsearch, which expect structured data rather than plain text.

The formatter handles three main logging patterns: dictionary logging (where you pass a dict directly), string logging (where you pass a message string), and exception logging (where it captures exception type, message, and stack trace). You can add custom fields to every log entry, customize field names, and control timestamp formatting. It integrates seamlessly with Python's standard logging.config.dictConfig, allowing you to configure it via Python dict or YAML file.

Use it for:

  • Send application logs to Splunk or Elasticsearch with proper JSON structure for indexing and search.
  • Add custom metadata fields (service name, environment, request ID) to every log entry automatically.
  • Capture exception details including type, message, and full stack trace in a structured JSON format.
  • Replace plain-text logging with structured output for easier parsing and analysis in log aggregation platforms.
  • Configure JSON logging via YAML or dictConfig without modifying application code.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Formats Python logging records as JSON output, enabling structured logs suitable for ingestion by log aggregation platforms like Splunk or Elasticsearch.

Yes, if you need structured JSON logging for a log aggregation platform. The package is stable, dependency-free, and straightforward to integrate. Dormant maintenance is acceptable for a focused formatter—the core logging API is unlikely to change. No known vulnerabilities. Install if you're already using Splunk, Elasticsearch, or similar systems; skip if you only need plain-text or Python's default formatting.

Install

logging-json on PyPI

pip

pip install logging-json

uv

uv add logging-json

poetry

poetry add logging-json

Installing logging-json

Before you install

Low friction: pure Python wheel with no runtime dependencies. Dormant maintenance (last commit 2025-02-04, 556 days since release) but marked Production/Stable and supports current Python versions through 3.13.

License in practice

MIT License permits unrestricted use, modification, and distribution with minimal obligations—suitable for any project type.

Quickstart

import logging
import logging_json

formatter = logging_json.JSONFormatter(fields={
    "level_name": "levelname",
    "thread_name": "threadName"
})
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger = logging.getLogger()
logger.addHandler(handler)
logger.info({"key": "value"})

Requires Python 3.9 or later.

Verify before relying

  • Whether the package is actively maintained or if dormant status signals end-of-life intent.
  • Performance characteristics when formatting high-volume logging streams.
  • Compatibility with async logging frameworks or concurrent logging scenarios.

Package facts

License MIT License Copyright (c) 2025 Colin Bounouar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 556 days since the last release
Last repo commit
First released
Downloads 271,433/month — #8,222 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: logging_json-0.6.0-py3-none-any.whl

Keywords: logging, json

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseNatural Language :: EnglishProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Topic :: Software Development :: Build ToolsTyping :: Typed

Tags

json logging formatterstructured logging pythonjson output for logselasticsearch loggingsplunk log formattingpython logging jsonlog aggregation formatting
structured-logginglog-aggregation

More Build Tools packages