summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2006-01-16 09:27:10 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2006-01-16 09:27:10 (GMT)
commite928977b80de1dbbf8dc31e2af387bd594a7a506 (patch)
tree54d934d4c4f5172ca457b788f6ec7de01a3b74fd /Lib
parentd952041dc7e9c9520302fb1086119e356b46a645 (diff)
downloadcpython-e928977b80de1dbbf8dc31e2af387bd594a7a506.zip
cpython-e928977b80de1dbbf8dc31e2af387bd594a7a506.tar.gz
cpython-e928977b80de1dbbf8dc31e2af387bd594a7a506.tar.bz2
Exceptions raised during renaming in rotating file handlers are now passed to handleError (except for SystemExit and KeyboardInterrupt, which are re-raised).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/logging/handlers.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index c6b526a..9e1bec1 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -126,7 +126,12 @@ class RotatingFileHandler(BaseRotatingHandler):
dfn = self.baseFilename + ".1"
if os.path.exists(dfn):
os.remove(dfn)
- os.rename(self.baseFilename, dfn)
+ try:
+ os.rename(self.baseFilename, dfn)
+ except (KeyboardInterrupt, SystemExit):
+ raise
+ except:
+ pass
#print "%s -> %s" % (self.baseFilename, dfn)
if self.encoding:
self.stream = codecs.open(self.baseFilename, 'w', self.encoding)
@@ -270,7 +275,12 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple)
if os.path.exists(dfn):
os.remove(dfn)
- os.rename(self.baseFilename, dfn)
+ try:
+ os.rename(self.baseFilename, dfn)
+ except (KeyboardInterrupt, SystemExit):
+ raise
+ except:
+ pass
if self.backupCount > 0:
# find the oldest log file and delete it
s = glob.glob(self.baseFilename + ".20*")