diff options
author | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2012-03-10 22:34:06 +0100 |
---|---|---|
committer | Elrond <elrond+mediagoblin.org@samba-tng.org> | 2012-03-10 22:48:24 +0100 |
commit | 193e0f534621f0f50f1fa05a3fc63e73ff0513e8 (patch) | |
tree | 135e780f07097740e58ee0cfad1426d414dfbf23 | |
parent | 3c7d451c71c1411e23cc16d6001394eb1a74dc62 (diff) | |
download | mediagoblin-193e0f534621f0f50f1fa05a3fc63e73ff0513e8.tar.lz mediagoblin-193e0f534621f0f50f1fa05a3fc63e73ff0513e8.tar.xz mediagoblin-193e0f534621f0f50f1fa05a3fc63e73ff0513e8.zip |
Improve logging of sql queries a bit.
Docs:
http://docs.sqlalchemy.org/en/latest/core/engines.html#configuring-logging
So for an application utilizing python logging for real
(and MediaGoblin should) the rule is:
- Don't use echo=True,
- but reconfigure the appropiate loggers' level.
So replaced the echo=True by a line to reconfigure the
appropiate logger to achieve the same effect.
This still dumps whole bloats of SQL queries into the main
log, but at least they're not duped any more.
-rw-r--r-- | mediagoblin/db/sql/open.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mediagoblin/db/sql/open.py b/mediagoblin/db/sql/open.py index a8677bcb..b1f389e8 100644 --- a/mediagoblin/db/sql/open.py +++ b/mediagoblin/db/sql/open.py @@ -16,6 +16,7 @@ from sqlalchemy import create_engine +import logging from mediagoblin.db.sql.base import Session from mediagoblin.db.sql.models import Base @@ -41,7 +42,8 @@ class DatabaseMaster(object): def setup_connection_and_db_from_config(app_config): - engine = create_engine(app_config['sql_engine'], echo=True) + engine = create_engine(app_config['sql_engine']) + logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) Session.configure(bind=engine) return "dummy conn", DatabaseMaster(engine) |