[Collab-qa-commits] r1774 - udd/udd

Andreas Tille tille at alioth.debian.org
Tue Aug 10 13:13:08 UTC 2010


Author: tille
Date: 2010-08-10 13:13:07 +0000 (Tue, 10 Aug 2010)
New Revision: 1774

Modified:
   udd/udd/ddtp_gatherer.py
Log:
Try to avoid reading logger configuration file


Modified: udd/udd/ddtp_gatherer.py
===================================================================
--- udd/udd/ddtp_gatherer.py	2010-08-08 13:36:15 UTC (rev 1773)
+++ udd/udd/ddtp_gatherer.py	2010-08-10 13:13:07 UTC (rev 1774)
@@ -23,10 +23,8 @@
 from psycopg2 import IntegrityError, InternalError
 
 import logging
-from logging.config import fileConfig
+import logging.handlers
 
-fileConfig("logging.ini")
-
 debug=0
 def to_unicode(value, encoding='utf-8'):
     if isinstance(value, str):
@@ -63,6 +61,11 @@
     self.assert_my_config('path', 'files', 'table', 'releases')
     my_config = self.my_config
     self.log = logging.getLogger(self.__class__.__name__)
+    self.log.setLevel(logging.INFO)
+    handler = logging.handlers.RotatingFileHandler(filename=self.__class__.__name__+'.log',mode='w')
+    formatter = logging.Formatter("%(asctime)s - %(levelname)s - (%(lineno)d): %(message)s")
+    handler.setFormatter(formatter)
+    self.log.addHandler(handler)
 
     cur = self.cursor()
     query = "PREPARE ddtp_delete (text, text) AS DELETE FROM %s WHERE release = $1 AND language = $2" % my_config['table']




More information about the Collab-qa-commits mailing list