Commits

Zhang Huangbin committed ace1c80

Set 'log_level = error' by default.
Add exception handler in initializing mysql connection.

  • Participants
  • Parent commits f3c80e4

Comments (0)

Files changed (3)

File etc/iredapd-rr.ini.sample

 log_type        = file
 log_file        = /var/log/iredapd-rr.log
 
-# Log level: info, warning, error, debug.
-# 'info' is recommended for product use. sample log entry:
-#       INFO user@domain.ltd -> list@domain.ltd, DUNNO
-log_level       = info
+# Log level: info, error, debug.
+log_level       = error
 
 # Backend: ldap, mysql.
 backend = ldap

File etc/iredapd.ini.sample

 log_type        = file
 log_file        = /var/log/iredapd.log
 
-# Log level: info, warning, error, debug.
-# 'info' is recommended for product use. sample log entry:
-#       INFO user@domain.ltd -> list@domain.ltd, DUNNO
-log_level       = info
+# Log level: info, error, debug.
+log_level       = error
 
 # Backend: ldap, mysql.
 backend = ldap

File src/iredapd.py

         # Turn off debug mode.
         web.config.debug = False
 
-        self.db = web.database(
-            dbn='mysql',
-            host=cfg.get('mysql', 'server', 'localhost'),
-            db=cfg.get('mysql', 'db', 'vmail'),
-            user=cfg.get('mysql', 'user', 'vmail'),
-            pw=cfg.get('mysql', 'password'),
-        )
+        try:
+            self.db = web.database(
+                dbn='mysql',
+                host=cfg.get('mysql', 'server', 'localhost'),
+                db=cfg.get('mysql', 'db', 'vmail'),
+                user=cfg.get('mysql', 'user', 'vmail'),
+                pw=cfg.get('mysql', 'password'),
+            )
+        except Exception, e:
+            logging.error("Error while creating database connection: %s" % str(e))
 
     def handle_data(self, map):
         if 'sender' in map.keys() and 'recipient' in map.keys():