summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/logging')
-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*")