[FIX] *: fix/rationalize db logging to avoid incorrect values during logging
authorOlivier Dony <odo@openerp.com>
Fri, 1 Mar 2013 12:07:44 +0000 (13:07 +0100)
committerOlivier Dony <odo@openerp.com>
Fri, 1 Mar 2013 12:07:44 +0000 (13:07 +0100)
commitdb81edc2872c4ccf9d4a3f596d0ec2040fa4a58f
treee649f9e32b14b891e561eb4fb4787e2116010a48
parentb7625512110f470cdd363446b6539ef6996c1ee7
[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
openerp/addons/base/ir/ir_cron.py
openerp/modules/registry.py
openerp/netsvc.py
openerp/osv/osv.py
openerp/service/web_services.py
openerp/service/wsgi_server.py
openerp/sql_db.py