Python Logging Config Generator
Generate production-ready logging config for Django, FastAPI, Flask, structlog, JSON, Sentry — in seconds!
About the Python Logging Config Generator
This tool writes a logging.config.dictConfig dictionary as JSON. In Development mode, the console handler uses a readable text formatter. In Production mode, it uses python-json-logger's JSON formatter, and you can add request and user fields and a Sentry error handler.
Example
Input: Production (JSON), with Sentry ticked.
Output (excerpt):
"handlers": {
"console": {"class": "logging.StreamHandler", "formatter": "json"},
"sentry": {"level": "ERROR", "class": "raven.contrib.django.handlers.SentryHandler"}
}
Limits
- To load the result:
logging.config.dictConfig(json.load(open("logging.json"))). The JSON formatter needspip install python-json-logger. - The Sentry handler refers to the old
ravenclient, which is no longer maintained. For current projects, leave Sentry unticked and set upsentry-sdk, whose logging integration hooks into logging for you. - Ticking Request ID / User adds
%(request_id)sand%(user_id)sto the format string. You need a logging filter or adapter that sets those attributes, or logging reports a formatting error for records that lack them. - Datadog Fields currently changes nothing in the output.
Privacy
All conversion happens in JavaScript inside your browser. The tool code on this page makes no network request with what you type, so your input is not uploaded or stored by PyInns. (The page itself still loads ads and shared libraries from third-party CDNs.)