mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-95804: Respect MemoryHandler.flushOnClose in logging shutdown. (GH-95857)
This commit is contained in:
parent
71c3d649b5
commit
37c0f9ccc0
4 changed files with 37 additions and 1 deletions
|
@ -2245,7 +2245,11 @@ def shutdown(handlerList=_handlerList):
|
|||
if h:
|
||||
try:
|
||||
h.acquire()
|
||||
h.flush()
|
||||
# MemoryHandlers might not want to be flushed on close,
|
||||
# but circular imports prevent us scoping this to just
|
||||
# those handlers. hence the default to True.
|
||||
if getattr(h, 'flushOnClose', True):
|
||||
h.flush()
|
||||
h.close()
|
||||
except (OSError, ValueError):
|
||||
# Ignore errors which might be caused
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue