[IMP] openerp.netsvc: _logger with fully qualified module name.
bzr revid: vmt@openerp.com-20120124162245-sz7iujhxalwzroqt
This commit is contained in:
parent
cc081b5482
commit
48adfc8ff3
|
@ -131,7 +131,7 @@ class ir_cron(osv.osv):
|
||||||
if model and hasattr(model, method_name):
|
if model and hasattr(model, method_name):
|
||||||
method = getattr(model, method_name)
|
method = getattr(model, method_name)
|
||||||
try:
|
try:
|
||||||
netsvc.log('cron', (cr.dbname,uid,'*',model_name,method_name)+tuple(args), channel=logging.DEBUG,
|
netsvc.log(__name__, (cr.dbname,uid,'*',model_name,method_name)+tuple(args), channel=logging.DEBUG,
|
||||||
depth=(None if _logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1), fn='object.execute')
|
depth=(None if _logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1), fn='object.execute')
|
||||||
if _logger.isEnabledFor(logging.DEBUG):
|
if _logger.isEnabledFor(logging.DEBUG):
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
|
|
@ -38,6 +38,8 @@ from loglevels import *
|
||||||
import tools
|
import tools
|
||||||
import openerp
|
import openerp
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
def close_socket(sock):
|
def close_socket(sock):
|
||||||
""" Closes a socket instance cleanly
|
""" Closes a socket instance cleanly
|
||||||
|
|
||||||
|
@ -100,12 +102,11 @@ class ExportService(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_services = {}
|
_services = {}
|
||||||
_logger = logging.getLogger('web-services')
|
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
ExportService._services[name] = self
|
ExportService._services[name] = self
|
||||||
self.__name = name
|
self.__name = name
|
||||||
self._logger.debug("Registered an exported service: %s" % name)
|
_logger.debug("Registered an exported service: %s" % name)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def getService(cls,name):
|
def getService(cls,name):
|
||||||
|
@ -224,9 +225,6 @@ class Server:
|
||||||
# all I/O blocking operations
|
# all I/O blocking operations
|
||||||
_busywait_timeout = 0.5
|
_busywait_timeout = 0.5
|
||||||
|
|
||||||
|
|
||||||
__logger = logging.getLogger('server')
|
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Server.__servers.append(self)
|
Server.__servers.append(self)
|
||||||
if Server.__is_started:
|
if Server.__is_started:
|
||||||
|
@ -241,7 +239,7 @@ class Server:
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.__logger.debug("called stub Server.start")
|
_logger.debug("called stub Server.start")
|
||||||
|
|
||||||
def _late_start(self):
|
def _late_start(self):
|
||||||
self.start()
|
self.start()
|
||||||
|
@ -250,7 +248,7 @@ class Server:
|
||||||
Server.__starter_threads.remove(thr)
|
Server.__starter_threads.remove(thr)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.__logger.debug("called stub Server.stop")
|
_logger.debug("called stub Server.stop")
|
||||||
|
|
||||||
def stats(self):
|
def stats(self):
|
||||||
""" This function should return statistics about the server """
|
""" This function should return statistics about the server """
|
||||||
|
@ -260,7 +258,7 @@ class Server:
|
||||||
def startAll(cls):
|
def startAll(cls):
|
||||||
if cls.__is_started:
|
if cls.__is_started:
|
||||||
return
|
return
|
||||||
cls.__logger.info("Starting %d services" % len(cls.__servers))
|
_logger.info("Starting %d services" % len(cls.__servers))
|
||||||
for srv in cls.__servers:
|
for srv in cls.__servers:
|
||||||
srv.start()
|
srv.start()
|
||||||
cls.__is_started = True
|
cls.__is_started = True
|
||||||
|
@ -269,7 +267,7 @@ class Server:
|
||||||
def quitAll(cls):
|
def quitAll(cls):
|
||||||
if not cls.__is_started:
|
if not cls.__is_started:
|
||||||
return
|
return
|
||||||
cls.__logger.info("Stopping %d services" % len(cls.__servers))
|
_logger.info("Stopping %d services" % len(cls.__servers))
|
||||||
for thr in cls.__starter_threads:
|
for thr in cls.__starter_threads:
|
||||||
if not thr.finished.is_set():
|
if not thr.finished.is_set():
|
||||||
thr.cancel()
|
thr.cancel()
|
||||||
|
@ -312,18 +310,17 @@ def dispatch_rpc(service_name, method, params):
|
||||||
NET-RPC) is done in a upper layer.
|
NET-RPC) is done in a upper layer.
|
||||||
"""
|
"""
|
||||||
def _log(title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""):
|
def _log(title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""):
|
||||||
log(title, msg, channel=channel, depth=depth, fn=fn)
|
log(__name__, msg, channel=channel, depth=depth, fn=fn)
|
||||||
try:
|
try:
|
||||||
logger = logging.getLogger('result')
|
|
||||||
start_time = end_time = 0
|
start_time = end_time = 0
|
||||||
if logger.isEnabledFor(logging.DEBUG_RPC_ANSWER):
|
if _logger.isEnabledFor(logging.DEBUG_RPC_ANSWER):
|
||||||
_log('service', tuple(replace_request_password(params)), depth=None, fn='%s.%s'%(service_name,method))
|
_log('service', tuple(replace_request_password(params)), depth=None, fn='%s.%s'%(service_name,method))
|
||||||
if logger.isEnabledFor(logging.DEBUG_RPC):
|
if _logger.isEnabledFor(logging.DEBUG_RPC):
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
result = ExportService.getService(service_name).dispatch(method, params)
|
result = ExportService.getService(service_name).dispatch(method, params)
|
||||||
if logger.isEnabledFor(logging.DEBUG_RPC):
|
if _logger.isEnabledFor(logging.DEBUG_RPC):
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
if not logger.isEnabledFor(logging.DEBUG_RPC_ANSWER):
|
if not _logger.isEnabledFor(logging.DEBUG_RPC_ANSWER):
|
||||||
_log('service (%.3fs)' % (end_time - start_time), tuple(replace_request_password(params)), depth=1, fn='%s.%s'%(service_name,method))
|
_log('service (%.3fs)' % (end_time - start_time), tuple(replace_request_password(params)), depth=1, fn='%s.%s'%(service_name,method))
|
||||||
_log('execution time', '%.3fs' % (end_time - start_time), channel=logging.DEBUG_RPC_ANSWER)
|
_log('execution time', '%.3fs' % (end_time - start_time), channel=logging.DEBUG_RPC_ANSWER)
|
||||||
_log('result', result, channel=logging.DEBUG_RPC_ANSWER)
|
_log('result', result, channel=logging.DEBUG_RPC_ANSWER)
|
||||||
|
|
Loading…
Reference in New Issue