A logging Formatter that appends extra data as JSON, e.g. for loggly
import logging.config logging.config.dictConfig({ 'version': 1, 'formatters': { 'append_json': { '()': 'logging_json_formatter.AppendJSONFormatter', 'format': '%(asctime)s %(name)s %(levelname)s %(funcName)s %(filename)s:%(lineno)s %(message)s', # only use a specific set of keys 'limit_keys_to': ['org_uuid', 'app_uuid'], # force keys that are ignored by default 'force_keys': ('levelname', 'lineno'), } }, 'handlers': { 'syslog': { 'level': 'ERROR', 'class': 'logging.handlers.SysLogHandler' 'address': '/dev/log', 'formatter': 'append_json' }, }, }