[Python-checkins] r84259 - in python/branches: py3k/Lib/logging/handlers.py release27-maint/Lib/logging/handlers.py

vinay.sajip python-checkins at python.org
Sun Aug 22 20:11:02 CEST 2010


Author: vinay.sajip
Date: Sun Aug 22 20:11:02 2010
New Revision: 84259

Log:
Issue #9512: Made comment more informative.

Modified:
   python/branches/py3k/Lib/logging/handlers.py
   python/branches/release27-maint/Lib/logging/handlers.py

Modified: python/branches/py3k/Lib/logging/handlers.py
==============================================================================
--- python/branches/py3k/Lib/logging/handlers.py	(original)
+++ python/branches/py3k/Lib/logging/handlers.py	Sun Aug 22 20:11:02 2010
@@ -103,8 +103,13 @@
 
         If maxBytes is zero, rollover never occurs.
         """
+        # If rotation/rollover is wanted, it doesn't make sense to use another
+        # mode. If for example 'w' were specified, then if there were multiple
+        # runs of the calling application, the logs from previous runs would be
+        # lost if the 'w' is respected, because the log file would be truncated
+        # on each run.
         if maxBytes > 0:
-            mode = 'a' # doesn't make sense otherwise!
+            mode = 'a'
         BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
         self.maxBytes = maxBytes
         self.backupCount = backupCount

Modified: python/branches/release27-maint/Lib/logging/handlers.py
==============================================================================
--- python/branches/release27-maint/Lib/logging/handlers.py	(original)
+++ python/branches/release27-maint/Lib/logging/handlers.py	Sun Aug 22 20:11:02 2010
@@ -108,8 +108,13 @@
 
         If maxBytes is zero, rollover never occurs.
         """
+        # If rotation/rollover is wanted, it doesn't make sense to use another
+        # mode. If for example 'w' were specified, then if there were multiple
+        # runs of the calling application, the logs from previous runs would be
+        # lost if the 'w' is respected, because the log file would be truncated
+        # on each run.
         if maxBytes > 0:
-            mode = 'a' # doesn't make sense otherwise!
+            mode = 'a'
         BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
         self.maxBytes = maxBytes
         self.backupCount = backupCount


More information about the Python-checkins mailing list