Closed Andrew-Chen-Wang closed 4 months ago
Ah I see from the resolution of #153 that Django doesn't support it; I feel like the logger.warn should actually print out exc, at least during debugging log level
Perhaps a better alternative here is to make a documentation and add
"How to use Granian with django?"
I honestly think the current implementation is fine. Lifespan is a standard ASGI specification, the fact Django is widely adopted out there doesn't imply Granian should make exceptions in its handlers.
Eventually, the warning message might be enhanced to suggest the user to switch to asginl
interface, but that's how much edits I am willing to do on the matter, also given the long discussions that took place in #153.
@gi0baro why not at least pass the underlying exception as a logger debug message?
@gi0baro why not at least pass the underlying exception as a logger debug message?
It can be re-implemented. It was removed due to people complaining about receiving errors while the application was actually running fine and/or the amount of errors logged 🤷♂️
I can understand why:
https://github.com/emmett-framework/granian/commit/08803c504dc04891582f82c7f125c1979c76f9d9
It seems like the exception was passed in for logger.warn
, but most people's Sentry or loggers aren't set to DEBUG log level. Would it make sense to have two logging lines?:
except Exception as e:
logger.warn("ASGI Lifespan protocol not supported")
logger.debug("Exception", exc_info=e)
I can understand why:
It seems like the exception was passed in for
logger.warn
, but most people's Sentry or loggers aren't set to DEBUG log level. Would it make sense to have two logging lines?:except Exception as e: logger.warn("ASGI Lifespan protocol not supported") logger.debug("Exception", exc_info=e)
That would require to set --log-level debug
in Granian though, even if Django is in debug mode..
To me seems fine, but I'm not sure it would be valuable to users.
Hi I'm getting the following with a standard Django app OOTB (version 5.0.6, granian 1.3.2)
To reproduce