skillfed

json-logging

JSON Python Logging

json-logging v1.5.1 962.2K downloads/30d#4,630 on PyPI310
Permissive license Apache License 2.0 Active released

What it is and what it does

json-logging wraps Python's standard logging module to emit structured JSON output instead of plain text, making logs automatically indexable and searchable by centralized logging infrastructure. It integrates directly with web frameworks (FastAPI, Flask, Sanic, Quart, Connexion) to automatically instrument HTTP requests, extract correlation IDs for distributed tracing, and attach request context to log entries. For non-web applications, it provides basic JSON logging without correlation tracking.

The library is designed for minimal setup—a single initialization call enables JSON output across all loggers—and supports injecting arbitrary extra properties into log records. It has been used in production since 2017 with more than 8 millions downloads, though the current maintainer is seeking someone to take over active development.

Use it for:

  • Enable ELK or EFK stack ingestion by converting Python app logs to JSON format for Elasticsearch indexing
  • Instrument FastAPI or Flask web services to automatically log HTTP requests with correlation IDs for distributed tracing
  • Attach request context and correlation IDs to downstream service calls for end-to-end request tracking
  • Centralize logs from multiple Python services to AWS Cloudwatch or GCP Stackdriver with structured fields
  • Add custom properties to log records for richer log analysis via extra parameter

Worth the install?

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

Configures Python's standard logging module to emit structured JSON logs compatible with centralized logging platforms like ELK, EFK, AWS Cloudwatch, and GCP Stackdriver.

Yes, with conditions. The package is production-ready, has no dependencies, and solves a real problem for teams using centralized logging. However, the maintainer is actively seeking new owners due to work commitments. If your team can tolerate potential delays in future maintenance or is willing to fork, it is a solid choice; otherwise, verify the transition status before committing to a new project.

Install

json-logging on PyPI

pip

pip install json-logging

uv

uv add json-logging

poetry

poetry add json-logging

Installing json-logging

Before you install

Low friction: pure Python with no runtime dependencies, distributed as a wheel. Actively maintained with last commit on 2026-06-17 and 310 repository stars. Maintainer is seeking new maintainers due to work commitments.

License in practice

Apache License 2.0 (permissive): you may use, modify, and distribute this package freely in commercial and open-source projects, provided you include a copy of the license and state significant changes.

Quickstart

pip install json-logging

import json_logging, logging, sys
json_logging.init_non_web(enable_json=True)
logger = logging.getLogger("test-logger")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.info("test logging statement")

Verify before relying

  • Whether the maintainer transition affects ongoing support or release cadence
  • Specific Python version compatibility (requires_python is unspecified in metadata)

Package facts

License Apache License 2.0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 403 days since the last release
Last repo commit
First released
Downloads 962,210/month — #4,630 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: json_logging-1.5.1-py2.py3-none-any.whl

Keywords: json, elastic, python, python3, python2, logging, logging-library, json, elasticsearch, elk, elk-stack, logstash, kibana

Development Status :: 5 - Production/StableFramework :: FlaskIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 3Topic :: System :: Logging

Tags

json logging pythonstructured logging elasticsearchelk stack python loggingjson formatter loggingdistributed tracing correlation idweb framework request loggingcloudwatch json logs
structured-loggingdistributed-tracingelk-stack

More Logging packages