diff options
author | Rob Crittenden <rcritten@redhat.com> | 2015-05-07 15:51:23 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2015-05-07 16:08:04 -0400 |
commit | abcefb0f2eece549371f951b58144188d2ac9307 (patch) | |
tree | 12ecde83b2eacc47e788a03ac84c65a7ff11b353 | |
parent | 9520939c3f3bc4c292238dcf28f3e66a9b8201bc (diff) | |
download | ipsilon-abcefb0f2eece549371f951b58144188d2ac9307.tar.gz ipsilon-abcefb0f2eece549371f951b58144188d2ac9307.tar.xz ipsilon-abcefb0f2eece549371f951b58144188d2ac9307.zip |
Add db.conn.log option to suppress sql logs by default
The Store logging is quite verbose with a flurry of
init and destroy messages with each session. Setting
db.conn.log to False (default) will suppress these. If one
needs to do connection tracing it can be enabled.
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
-rw-r--r-- | examples/ipsilon.conf | 1 | ||||
-rw-r--r-- | ipsilon/util/data.py | 8 | ||||
-rw-r--r-- | templates/install/ipsilon.conf | 1 |
3 files changed, 9 insertions, 1 deletions
diff --git a/examples/ipsilon.conf b/examples/ipsilon.conf index e89f970..bd4924b 100644 --- a/examples/ipsilon.conf +++ b/examples/ipsilon.conf @@ -2,6 +2,7 @@ debug = True tools.log_request_response.on = False template_dir = "templates" +db.conn.log = False log.screen = True base.mount = "/idp" diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py index eec00b5..26fa859 100644 --- a/ipsilon/util/data.py +++ b/ipsilon/util/data.py @@ -37,11 +37,13 @@ class SqlStore(Log): @classmethod def get_connection(cls, name): if name not in cls.__instances.keys(): - logging.debug('SqlStore new: %s', name) + if cherrypy.config.get('db.conn.log', False): + logging.debug('SqlStore new: %s', name) cls.__instances[name] = SqlStore(name) return cls.__instances[name] def __init__(self, name): + self.db_conn_log = cherrypy.config.get('db.conn.log', False) self.debug('SqlStore init: %s' % name) self.name = name engine_name = name @@ -61,6 +63,10 @@ class SqlStore(Log): self._dbengine = create_engine(engine_name, **pool_args) self.is_readonly = False + def debug(self, fact): + if self.db_conn_log: + super(SqlStore, self).debug(fact) + def engine(self): return self._dbengine diff --git a/templates/install/ipsilon.conf b/templates/install/ipsilon.conf index 522cb38..b57aa55 100644 --- a/templates/install/ipsilon.conf +++ b/templates/install/ipsilon.conf @@ -2,6 +2,7 @@ debug = ${debugging} tools.log_request_response.on = False template_dir = "templates" +db.conn.log = False log.screen = ${debugging} base.mount = "/${instance}" |