[MERGE] *: fix/rationalize db logging to avoid incorrect values during logging
authorOlivier Dony <odo@openerp.com>
Fri, 1 Mar 2013 18:25:10 +0000 (19:25 +0100)
committerOlivier Dony <odo@openerp.com>
Fri, 1 Mar 2013 18:25:10 +0000 (19:25 +0100)
commite373ac5aebfb656f587a22340b87c9053ae8226b
tree3f5384fb5e596f2108a44fdb01f2653d6b97a875
parenta451cacb91436146be1f3f44955f88bd9cf924d9
parentdb81edc2872c4ccf9d4a3f596d0ec2040fa4a58f
[MERGE] *: 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 as possible:
- in web, 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-20130301182510-1fqo9o8di0jw95b5
openerp/modules/registry.py