[Python-checkins] cpython (2.7): Issue #18940: Handled low-volume logging when delay is True.
vinay.sajip
python-checkins at python.org
Fri Sep 6 11:11:51 CEST 2013
http://hg.python.org/cpython/rev/6a591870017c
changeset: 85563:6a591870017c
branch: 2.7
parent: 85552:dc4e6b48c321
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Fri Sep 06 10:09:45 2013 +0100
summary:
Issue #18940: Handled low-volume logging when delay is True.
files:
Lib/logging/handlers.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -137,7 +137,9 @@
dfn = self.baseFilename + ".1"
if os.path.exists(dfn):
os.remove(dfn)
- os.rename(self.baseFilename, dfn)
+ # Issue 18940: A file may not have been created if delay is True.
+ if os.path.exists(self.baseFilename):
+ os.rename(self.baseFilename, dfn)
#print "%s -> %s" % (self.baseFilename, dfn)
self.stream = self._open()
@@ -343,7 +345,9 @@
dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple)
if os.path.exists(dfn):
os.remove(dfn)
- os.rename(self.baseFilename, dfn)
+ # Issue 18940: A file may not have been created if delay is True.
+ if os.path.exists(self.baseFilename):
+ os.rename(self.baseFilename, dfn)
if self.backupCount > 0:
# find the oldest log file and delete it
#s = glob.glob(self.baseFilename + ".20*")
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list