-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Daphne disables warnings module #352
Comments
Versions:
|
Hi @mjnaderi — initial ideal would be to run with verbosity 1 (or greater). |
Hi @carltongibson. I'm running the project using I think this issue can make a lot of confusion for users. It's changing the default behavior of warnings module. All runtime warning messages from all packages (even Django itself!) are lost, and it's hard to find the reason. |
I tried increasing verbosity (by manually modifying LOGGING = {
...
"loggers": {
"daphne": {
"handlers": ["console"]
}
},
} |
OK, so at the least we could do with some docs here. Passing verbosity would also be worthwhile. I need to have a look into WHY the behaviour is as it is before deciding how/if we can change it. Happy if you want to have a dig though! Thanks for the report! |
I did some experiment on this. I didn't find out why twisted redirects warnings to log messages. But I implemented a simple work-around: mjnaderi/channels@13fbe8a |
Hi @mjnaderi — glad you found a workaround. If you want to make a PR to Channel's |
Thanks @carltongibson |
@carltongibson any update on this? |
Hi. I'm using django-channels in a django project. I wanted to use Python's
warnings
module to display a warning message. But it didn't work. Nothing was printed. I started the server withpython -Wa manage.py runserver
, but the warning didn't show up.My code:
I removed
channels
fromINSTALLED_APPS
and ranrunserver
again. Issue was gone and the message was printed.I tracked down the issue to this line in daphne code (
server.py
):In
beginLoggingTo
, twisted runs this code:which replaces
warnings.showwarning
with a custom function. (When I comment this line in twisted, issue is fixed.)Would you please show me how can I use Python's
warnings
module properly?The text was updated successfully, but these errors were encountered: