json-logging
JSON Python Logging
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-logginguv
uv add json-loggingpoetry
poetry add json-loggingInstalling 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
Tags
More Logging packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
python-json-loggerFormats Python logging output as JSON, making…
permissive · top 1,000 on PyPI
structlogstructlog is a structured logging library that…
permissive · top 1,000 on PyPI
loguruLoguru provides a pre-configured logger that…
permissive · top 1,000 on PyPI
coloredlogsAdds colored output to Python's standard…
permissive · top 1,000 on PyPI
wandbwandb is a machine learning experiment tracking…
permissive · top 1,000 on PyPI
ecs-loggingFormats Python logs as Elastic Common Schema…
permissive · top 5,000 on PyPI
mo-logsProvides structured JSON logging with…
copyleft · top 15,000 on PyPI
splunk-hec-handlerIntegrates Python logging with Splunk's HTTP…
permissive · top 15,000 on PyPI
logstash_formatterFormats Python logging output as JSON objects…
permissive · top 15,000 on PyPI
cloudwatchA Python logging handler that sends log events…
permissive · top 15,000 on PyPI
JSON-log-formatterFormats Python logging records as JSON,…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-loggingIntegrates Python's standard logging module…
permissive · top 1,000 on PyPI
daiquiriDaiquiri simplifies Python logging…
permissive · top 15,000 on PyPI
google-cloud-loggingWrites log entries to Google Cloud Logging and…
permissive · top 1,000 on PyPI
tinybird-python-sdkIngest NDJSON data into Tinybird Data Sources…
unclear · top 15,000 on PyPI