--- id: logging-json version: "0.6.0" 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) license_treatment: permissive maintenance: dormant --- # logging-json — JSON formatter for python logging License: permissive · Maintenance: dormant · Downloads: 271.4K/mo ## 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 above — 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 pip install logging-json uv add logging-json 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_current - Install friction: low - Maintenance: dormant - Downloads: 271.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags json logging formatter, structured logging python, json output for logs, elasticsearch logging, splunk log formatting, python logging json, log aggregation formatting, structured-logging, log-aggregation [View on SkillFed](https://skillfed.io/packages/logging-json) · [View on PyPI](https://pypi.org/project/logging-json/)