feat: add taskName to RESERVED_ATTRS
taskName was added in Python 3.12. See https://docs.python.org/3/library/logging.html
@madzak, any chance this could be merged soon? 🙏🏻 😊 (And if this repository can no longer be actively maintained, any chance you'd select another maintainer, rather than having folks forking it?)
@madzak did you have the time to look at it?
This also affects me. This is the best workaround I've found so far in case anyone else needs a quick fix:
class CustomJsonFormatter(jsonlogger.JsonFormatter):
def __init__(self):
# 'taskName' was added to the Python 3.12 default log attributes,
# but only applies to async contexts so we can ignore it.
# jsonlogger does not yet include this attribute in its `RESERVED_ATTRS`
# var so we can add it ourselves as a workaround.
reserved_attrs = jsonlogger.RESERVED_ATTRS
if not 'taskName' in reserved_attrs:
reserved_attrs += ('taskName',)
super().__init__(reserved_attrs=reserved_attrs)
However this PR should really be merged instead to solve the problem for everyone.
Hi @em-may,
Just so you're aware it looks like python-json-logger is currently unmaintained, that said I am working on a maintained fork