When a request has an error, it seems that they're logged, which is good. The logging sets stack_info=True
by default, which seems useful in theory, but in practice, the stack is just the stack of the logger.error
call, rather than where the error occurred (the error stack is included by setting exc_info
). This stack trace is essentially always the same. For example:
Stack (most recent call last):
File "/opt/venv/lib/python3.9/site-packages/strawberry/fastapi/router.py", line 291, in execute
return await self.schema.execute(
File "/opt/venv/lib/python3.9/site-packages/strawberry/schema/schema.py", line 216, in execute
self.process_errors(result.errors, execution_context=execution_context)
File "/opt/venv/lib/python3.9/site-packages/strawberry/schema/base.py", line 88, in process_errors
StrawberryLogger.error(error, execution_context)
File "/opt/venv/lib/python3.9/site-packages/strawberry/utils/logging.py", line 32, in error
cls.logger.error(error, exc_info=error.original_error, **logger_kwargs)
File "/usr/local/lib/python3.9/logging/__init__.py", line 1475, in error
self._log(ERROR, msg, args, **kwargs)
File "/usr/local/lib/python3.9/logging/__init__.py", line 1589, in _log
self.handle(record)
File "/usr/local/lib/python3.9/logging/__init__.py", line 1599, in handle
self.callHandlers(record)
File "/usr/local/lib/python3.9/logging/__init__.py", line 1661, in callHandlers
hdlr.handle(record)
File "/usr/local/lib/python3.9/logging/__init__.py", line 952, in handle
self.emit(record)
File "/usr/local/lib/python3.9/logging/__init__.py", line 1083, in emit
msg = self.format(record)
File "/usr/local/lib/python3.9/logging/__init__.py", line 927, in format
return fmt.format(record)
strawberry/strawberry/schema/base.py
Line 87 in 0f6b4a0
strawberry/strawberry/utils/logging.py
Line 24 in 0f6b4a0
Potentially there's some intention behind setting stack_info=True
that isn't happening in practice. As it stands, this info is somewhat useless and just increases the size of logs.
Thank you for strawberry! π
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too