Closed
Description
StdlibFormatter inherits from logging.Formatter, but has a completely different constructor signature, making it incompatible with anything that takes the formatter class name.
StdlibFormatter signature: def __init__(self, stack_trace_limit=None, exclude_fields=()):
logging.Formatter signature: def __init__(self, fmt=None, datefmt=None, style='%', validate=True):
Any time you pass "ecs_logging.StdlibFormatter" where a library takes a class name for a log formatter (Django, Gunicorn, etc.), it fails with the following error:
File "/usr/local/lib/python3.8/logging/config.py", line 71, in fileConfig
formatters = _create_formatters(cp)
File "/usr/local/lib/python3.8/logging/config.py", line 119, in _create_formatters
f = c(fs, dfs, stl)
TypeError: __init__() takes from 1 to 3 positional arguments but 4 were given