Commits

Zhang Huangbin committed ace1c80

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

Comments (0)

Files changed (3)

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

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
         # 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():
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.