Commit 25b66510 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Use SIGRTMIN+0 to log debug informations.

This requires the live debugger to be enabled. Only master, storage and
client side handle this signal.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2158 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 4a991ede
......@@ -48,6 +48,7 @@ from neo.client.mq import MQ
from neo.client.pool import ConnectionPool
from neo.util import u64, parseMasterList
from neo.profiling import profiler_decorator, PROFILING_ENABLED
from neo.live_debug import register as registerLiveDebugger
if PROFILING_ENABLED:
# Those functions require a "real" python function wrapper before they can
......@@ -179,6 +180,7 @@ class Application(object):
self._nm_acquire = lock.acquire
self._nm_release = lock.release
self.compress = compress
registerLiveDebugger(on_log=self.log)
def log(self):
self.em.log()
......
......@@ -65,8 +65,14 @@ def debugHandler(sig, frame):
def pdbHandler(sig, frame):
pdb.set_trace()
def register():
def register(on_log=None):
if ENABLED:
signal.signal(signal.SIGUSR1, debugHandler)
signal.signal(signal.SIGUSR2, pdbHandler)
if on_log is not None:
# use 'kill -RTMIN <pid>
@decorate
def on_log_signal(signum, signal):
on_log()
signal.signal(signal.SIGRTMIN, on_log_signal)
......@@ -93,7 +93,7 @@ class Application(object):
self._current_manager = None
registerLiveDebugger()
registerLiveDebugger(on_log=self.log)
def log(self):
self.em.log()
......
......@@ -85,7 +85,7 @@ class Application(object):
if config.getUUID() is not None:
self.uuid = config.getUUID()
registerLiveDebugger()
registerLiveDebugger(on_log=self.log)
def log(self):
self.em.log()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment