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
Duplicate logs when use logging.basicConfig in application #1285
Comments
yes sounds sensible, fancy throwing a PR @guyskk ? |
Adding |
Any Update on this one? It's really annoying :( |
Has anyone identified a useful workaround in the meantime? |
@gretkierewicz That's not correct, Python Docs also note that https://docs.python.org/3/library/logging.html#logging.Logger.propagate
|
@matthew-viglione My workaround in the meantime has been: uvicorn_logger = logging.getLogger("uvicorn")
uvicorn_logger.removeHandler(uvicorn_logger.handlers[0]) |
|
* 🎨 refactored project name to config * ✨ added smtp variables to config * ✨ added email template for reset password * ✨ added emails and jinja2 * upgraded uvicorn version because of logging bug - encode/uvicorn#1285 * 🎨 refactored utils folder structure * ✨ handling forget password bt sending an email * 💄 cosmetic * 🔥 removed unused code * ✨ handling account verification by sending an email * 🔥 removed unused parameters * added logs * renamed function * import utils from its __init__.py * added reset_password_token_lifetime_seconds and verification_token_secret to config * added the reset password and user verification lifetime to the email templates * added validator for EMAILS_FROM_NAME * modified docker-compose env variables * added env variables section in README.md * fixed mypy * fixed bandit * added required env variables to ci
Checklist
master
.Describe the bug
When use logging.basicConfig to config logging in application, uvicorn logs will duplicate in console.
Steps to reproduce the bug
app.py:
run it:
Expected behavior
expect no duplicate logs.
Actual behavior
uvicorn.error logs duplicated:
Debugging material
I think the uvicorn logger should not propagate, because it already handled by uvicorn handler. And the behavior of gunicorn is no duplicate logs.
Add
"propagate": False
to https://github.com/encode/uvicorn/blob/master/uvicorn/config.py#L107 can fix the issue.Environment
Running uvicorn 0.15.0 with CPython 3.9.7 on Darwin
Additional context
Maybe related: #614
The text was updated successfully, but these errors were encountered: