cwconfig.py
changeset 5655 ef903fff826d
parent 5633 879590c52679
parent 5647 b21655cfc835
child 5768 1e73a466aa69
--- a/cwconfig.py	Tue Jun 01 17:06:41 2010 +0200
+++ b/cwconfig.py	Thu Jun 03 10:17:44 2010 +0200
@@ -291,7 +291,9 @@
     name = None
     # log messages format (see logging module documentation for available keys)
     log_format = '%(asctime)s - (%(name)s) %(levelname)s: %(message)s'
-    # nor remove appobjects based on unused interface
+    # the format below can be useful to debug multi thread issues:
+    # log_format = '%(asctime)s - [%(threadName)s] (%(name)s) %(levelname)s: %(message)s'
+    # nor remove appobjects based on unused interface [???]
     cleanup_interface_sobjects = True
 
 
@@ -687,7 +689,16 @@
                 logthreshold = 'DEBUG'
             else:
                 logthreshold = self['log-threshold']
-        init_log(self.debugmode, syslog, logthreshold, logfile, self.log_format)
+        if sys.platform == 'win32':
+            # no logrotate on win32, so use logging rotation facilities
+            # for now, hard code weekly rotation every sunday, and 52 weeks kept
+            # idea: make this configurable?
+            init_log(self.debugmode, syslog, logthreshold, logfile, self.log_format,
+                     rotation_parameters={'when': 'W6', # every sunday
+                                          'interval': 1,
+                                          'backupCount': 52,})
+        else:
+            init_log(self.debugmode, syslog, logthreshold, logfile, self.log_format)
         # configure simpleTal logger
         logging.getLogger('simpleTAL').setLevel(logging.ERROR)