Issue 33606: Improve logging performance when logger disabled (original) (raw)
Issue33606
This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/77787
classification
Title: | Improve logging performance when logger disabled | ||
---|---|---|---|
Type: | enhancement | Stage: | resolved |
Components: | Library (Lib) | Versions: | Python 3.8 |
process
Status: | closed | Resolution: | fixed |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | vinay.sajip | Nosy List: | vinay.sajip |
Priority: | normal | Keywords: | patch |
Created on 2018-05-22 19:15 by vinay.sajip, last changed 2022-04-11 14:59 by admin. This issue is now closed.
Pull Requests | |||
---|---|---|---|
URL | Status | Linked | Edit |
PR 7285 | merged | tuxtimo,2018-05-31 13:17 |
Messages (3) | ||
---|---|---|
msg317328 - (view) | Author: Vinay Sajip (vinay.sajip) * ![]() |
Date: 2018-05-22 19:15 |
If a logger is disabled (by setting it's disabled attribute to True), the check for this is done late in the dispatch of the logging event - during the handle() call - rather than isEnabledFor(), which would short-circuit some processing. So the check for logger.disabled should be moved to isEnabledFor(). Credit to Abhijit Gadgil for raising this: https://stackoverflow.com/questions/50453121/logger-disabled-check-much-later-in-python-logging-module-whats-the-rationale | ||
msg318368 - (view) | Author: Vinay Sajip (vinay.sajip) * ![]() |
Date: 2018-06-01 07:16 |
The check in handle() should remain, because there are some scenarios where handle is called directly (e.g. when receiving events over a socket and dispatching to handlers). So the change would just be to add an additional check in isEnabledFor(). | ||
msg318369 - (view) | Author: Vinay Sajip (vinay.sajip) * ![]() |
Date: 2018-06-01 07:29 |
New changeset 6e3ca645e71dd021fead5a70dc06d9b663612e3a by Vinay Sajip (Timo Furrer) in branch 'master': bpo-33606: improve logging performance when logger is disabled (GH-7285) https://github.com/python/cpython/commit/6e3ca645e71dd021fead5a70dc06d9b663612e3a |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:59:00 | admin | set | github: 77787 |
2018-06-01 07:32:21 | vinay.sajip | set | status: open -> closedresolution: fixedstage: patch review -> resolved |
2018-06-01 07:29:48 | vinay.sajip | set | messages: + |
2018-06-01 07:16:46 | vinay.sajip | set | messages: + |
2018-05-31 13:17:50 | tuxtimo | set | keywords: + patchstage: needs patch -> patch reviewpull_requests: + <pull%5Frequest6911> |
2018-05-22 19:15:59 | vinay.sajip | create |