diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-09-06 10:10:22 +0100 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-09-06 10:10:22 +0100 |
commit | 107a66fed811f222a96e08b8765d356d83a40e77 (patch) | |
tree | cd997e7305b9ad2c4b1e61f734da52aa72548930 /Lib/logging/handlers.py | |
parent | 69783575f1f79bec976915697de13df11599e5cb (diff) | |
download | cpython-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.py | 4 |
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) |