I use graphene application in starlette on uvicorn.
I would like to see exceptions logs with traceroute.
But at the moment it hides exceptions and I see only access log with "Bad request" message.
I've redirected all loggers I know to the root logger, except access log.
The root logger is turned to log messages properly, as I want, but it seems exceptions in app handlers are coaught and not propagated to the root logger.
I also have set up sys.excepthook
like:
def _exception_logging(exctype, value, tb):
traceback_string = ''.join(traceback.format_tb(tb, 10))
write_val = \
f'Traceback (most recent call last):\n{traceback_string}{exctype.__name__}: {value}'
logging.error(write_val)
And I set up exception hooks for threads. Usually it's enough to see all log messages.
I use the next json config file:
{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"default": {
"()": "uvicorn.logging.DefaultFormatter",
"fmt": "%(levelprefix)s %(message)s",
"use_colors": null
},
"access": {
"()": "uvicorn.logging.AccessFormatter",
"fmt": "[%(asctime)s] [%(process)s] [%(levelname)s]: %(client_addr)s - \"%(request_line)s\" %(status_code)s"
}
},
"handlers": {
"default": {
"formatter": "default",
"class": "logging.StreamHandler",
"stream": "ext://sys.stderr"
},
"access": {
"formatter": "access",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout"
}
},
"loggers": {
"uvicorn": {
"level": "INFO"
},
"uvicorn.exception": {
"level": "INFO"
},
"uvicorn.error": {
"level": "INFO"
},
"uvicorn.access": {
"handlers": [
"access"
],
"level": "INFO",
"propagate": false
}
}
}
I suspect something is wrong in the log config file.