summaryrefslogtreecommitdiff
path: root/Lib/logging/handlers.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2013-09-06 10:10:22 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2013-09-06 10:10:22 +0100
commit107a66fed811f222a96e08b8765d356d83a40e77 (patch)
treecd997e7305b9ad2c4b1e61f734da52aa72548930 /Lib/logging/handlers.py
parent69783575f1f79bec976915697de13df11599e5cb (diff)
downloadcpython-107a66fed811f222a96e08b8765d356d83a40e77.tar.gz
Issue #18940: Handled low-volume logging when delay is True.
Diffstat (limited to 'Lib/logging/handlers.py')
-rw-r--r--Lib/logging/handlers.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 93aa50ea83..f0f634e8d3 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -111,7 +111,9 @@ class BaseRotatingHandler(logging.FileHandler):
what the source is rotated to, e.g. 'test.log.1'.
"""
if not callable(self.rotator):
- os.rename(source, dest)
+ # Issue 18940: A file may not have been created if delay is True.
+ if os.path.exists(source):
+ os.rename(source, dest)
else:
self.rotator(source, dest)