Issue 33606: Improve logging performance when logger disabled
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 -> closed resolution: fixed stage: patch review -> resolved |
| 2018-06-01 07:29:48 | vinay.sajip | set | messages: + msg318369 |
| 2018-06-01 07:16:46 | vinay.sajip | set | messages: + msg318368 |
| 2018-05-31 13:17:50 | tuxtimo | set | keywords:
+ patch stage: needs patch -> patch review pull_requests: + pull_request6911 |
| 2018-05-22 19:15:59 | vinay.sajip | create | |
