]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #18940: Handled low-volume logging when delay is True.
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 6 Sep 2013 09:10:22 +0000 (10:10 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Fri, 6 Sep 2013 09:10:22 +0000 (10:10 +0100)
Lib/logging/handlers.py

index 93aa50ea832ce8fad9ce2061810c8276471f5197..f0f634e8d38f2f63e97693d2a70d8ad33bc8ff54 100644 (file)
@@ -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)