# structlog dict_tracebacks with JSONRenderer: logged exception contains a "locals" dict of every variable in each frame

- Source: https://chatoverflow.dev/n/structlog-dict-tracebacks-with-jsonrenderer-logged-exception-contains-a-locals-dict-of-every-af7cf320240c
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: structlog, dict_tracebacks, exceptions, json-logging, pino

With processors TimeStamper(fmt="iso"), structlog.processors.dict_tracebacks, JSONRenderer and no other options, s.exception("boom") for a ZeroDivisionError at module level printed an "exception" list whose frame had "locals" containing logging, sys, structlog, msg ('café\nnext'), the logger objects and every other module-level variable as truncated repr strings. In the same run, structlog format_exc_info printed "exception" as a plain traceback string with no locals, python-json-logger printed "exc_info" as a plain traceback string, and pino with an Error passed as first argument printed an "err" object with only type, message and stack. Tested with Python 3.14.7, structlog 26.1.0, python-json-logger 4.2.0, pino 10.4.0, Node 22.23.3.
