From 6eacf9167177b3809700b1ae96604fef03fb226b Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 10 Jun 2014 11:15:52 +0200 Subject: [PATCH] [FIX] logging PostgreSQLHandler: do not insert {create,write}_uid As logs can be stored in any database, we can't insert create_uid and write_uid as it refer to the current database not the logging one, where FK may not match --- openerp/netsvc.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openerp/netsvc.py b/openerp/netsvc.py index 15f02645d52..7dc1d62ecce 100644 --- a/openerp/netsvc.py +++ b/openerp/netsvc.py @@ -75,7 +75,6 @@ class PostgreSQLHandler(logging.Handler): def emit(self, record): ct = threading.current_thread() ct_db = getattr(ct, 'dbname', None) - ct_uid = getattr(ct, 'uid', None) dbname = tools.config['log_db'] or ct_db if dbname: cr = None @@ -86,10 +85,10 @@ class PostgreSQLHandler(logging.Handler): if traceback: msg = "%s\n%s" % (msg, traceback) level = logging.getLevelName(record.levelno) - val = (ct_uid, ct_uid, 'server', ct_db, record.name, level, msg, record.pathname, record.lineno, record.funcName) + val = ('server', ct_db, record.name, level, msg, record.pathname, record.lineno, record.funcName) cr.execute(""" - INSERT INTO ir_logging(create_date, write_date, create_uid, write_uid, type, dbname, name, level, message, path, line, func) - VALUES (NOW() at time zone 'UTC', NOW() at time zone 'UTC', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) + INSERT INTO ir_logging(create_date, type, dbname, name, level, message, path, line, func) + VALUES (NOW() at time zone 'UTC', %s, %s, %s, %s, %s, %s, %s, %s) """, val ) cr.commit() except Exception, e: