diff options
| author | Olivier Dony <odo@openerp.com> | 2013-03-01 13:07:44 +0100 |
|---|---|---|
| committer | Olivier Dony <odo@openerp.com> | 2013-03-01 13:07:44 +0100 |
| commit | db81edc2872c4ccf9d4a3f596d0ec2040fa4a58f (patch) | |
| tree | e649f9e32b14b891e561eb4fb4787e2116010a48 /openerp/sql_db.py | |
| parent | b7625512110f470cdd363446b6539ef6996c1ee7 (diff) | |
[FIX] *: fix/rationalize db logging to avoid incorrect values during logging
The setting/clearing of the tracking were not done
consistently, causing log messages that appeared
to come from one database while coming from another
one or none at all.
The tracker is now set at the earliest points
of request handling where we can:
- in web client, when creating WebRequests (dbname, uid)
- at RPC dispatching in server (uid)
- at cron job acquisition in CronWorker (dbname)
- at Registry acquisition in RegistryManager (dbname)
The tracker is cleared at the very entrance of
the request in the WSGI `application`, ensuring
that no logging is produced with an obsolete
db name. (It cannot be cleared at the end of
the request handling because the werkzeug
wrapper outputs more logging afterwards)
bzr revid: odo@openerp.com-20130301120744-jfitcmze2jldecod
Diffstat (limited to 'openerp/sql_db.py')
| -rw-r--r-- | openerp/sql_db.py | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/openerp/sql_db.py b/openerp/sql_db.py index 31540f7ae4c..9844de48d2a 100644 --- a/openerp/sql_db.py +++ b/openerp/sql_db.py @@ -41,7 +41,6 @@ import psycopg2.extensions from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT, ISOLATION_LEVEL_READ_COMMITTED, ISOLATION_LEVEL_REPEATABLE_READ from psycopg2.pool import PoolError from psycopg2.psycopg1 import cursor as psycopg1cursor -from threading import currentThread psycopg2.extensions.register_type(psycopg2.extensions.UNICODE) @@ -520,7 +519,6 @@ def db_connect(db_name): global _Pool if _Pool is None: _Pool = ConnectionPool(int(tools.config['db_maxconn'])) - currentThread().dbname = db_name return Connection(_Pool, db_name) def close_db(db_name): @@ -528,9 +526,6 @@ def close_db(db_name): global _Pool if _Pool: _Pool.close_all(dsn(db_name)) - ct = currentThread() - if hasattr(ct, 'dbname'): - delattr(ct, 'dbname') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
