From 78000cae6d03c9416daca95f2d18c805dbaaea04 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 5 Oct 2010 14:37:30 +0200 Subject: [PATCH] [IMP] netsvc: increase a bit default verbosity of debug_* levels for RPC query and results + lint cleanup bzr revid: odo@openerp.com-20101005123730-f75h4gu1ac8fjtfj --- bin/netsvc.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/netsvc.py b/bin/netsvc.py index e5a60f9d3ae..54a8ac68b14 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -211,7 +211,7 @@ def init_logger(): handler = logging.handlers.WatchedFileHandler(logf) else: handler = logging.handlers.FileHandler(logf) - except Exception, ex: + except Exception: sys.stderr.write("ERROR: couldn't create the logfile directory. Logging to the standard output.\n") handler = logging.StreamHandler(sys.stdout) else: @@ -269,11 +269,11 @@ class Logger(object): level_method('[%02d]: %s' % (idx+1, s,)) elif result: level_method(result[0]) - except IOError,e: + except IOError: # TODO: perhaps reset the logger streams? #if logrotate closes our files, we end up here.. pass - except: + except Exception: # better ignore the exception and carry on.. pass @@ -473,13 +473,13 @@ class OpenERPDispatcher: def dispatch(self, service_name, method, params): try: + logger = logging.getLogger('result') self.log('service', service_name) self.log('method', method) - self.log('params', params) + self.log('params', params, depth=(logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) and 3 or 1)) auth = getattr(self, 'auth_provider', None) result = ExportService.getService(service_name).dispatch(method, auth, params) - logger = logging.getLogger('result') - self.log('result', result, channel=logging.DEBUG_RPC_ANSWER, depth=(logger.isEnabledFor(logging.DEBUG_SQL) and 1 or None)) + self.log('result', result, channel=logging.DEBUG_RPC_ANSWER, depth=(logger.isEnabledFor(logging.DEBUG_SQL) and 5 or 3)) return result except Exception, e: self.log('exception', tools.exception_to_unicode(e))