New logging framework on 'next' (Blinkenlights users beware)

Chris Dennis cgdennis at btinternet.com
Tue Nov 1 17:30:50 GMT 2011


On 10/31/2011 07:02 PM, Chris Dennis wrote:
> On 10/28/2011 08:27 AM, Sebastian Spaeth wrote:
>> All UI backends have been converted to use python's logging
>> module.
>
> Excellent! I've just got that working, and it's a big improvement.

...except that the log file gets overwritten every time offlineimap is 
restarted.  Maybe some people would want it to do that, but for me, the 
following 1-character patch fixes it:

%<---------------------------------------------------------------------
diff --git a/offlineimap/ui/UIBase.py b/offlineimap/ui/UIBase.py
index 44c920f..75cb313 100644
--- a/offlineimap/ui/UIBase.py
+++ b/offlineimap/ui/UIBase.py
@@ -81,7 +81,7 @@ class UIBase(object):

      def setlogfile(self, logfile):
          """Create file handler which logs to file"""
-        fh = logging.FileHandler(logfile, 'wt')
+        fh = logging.FileHandler(logfile, 'at')
          #fh.setLevel(logging.DEBUG)
          file_formatter = logging.Formatter("%(asctime)s %(levelname)s: "
                           "%(message)s", '%Y-%m-%d %H:%M:%S')
%<---------------------------------------------------------------------

regards

Chris

-- 
Chris Dennis                                  cgdennis at btinternet.com
Fordingbridge, Hampshire, UK




More information about the OfflineIMAP-project mailing list