Commit 66e7ad71 authored by Boris Kocherov's avatar Boris Kocherov

improve logging

parent 467b6b86
......@@ -46,9 +46,10 @@ class Application(object):
self.getAddress()[-1],
self.pid()))
def stopProcess(self, process_pid):
"""Stop the process"""
def stop(self):
if hasattr(self, 'process'):
error = False
process_pid = self.process.pid
logger.debug("Stop Pid - %s", process_pid)
returncode = None
try:
......@@ -68,14 +69,13 @@ class Application(object):
pass
except TimeoutExpired:
logger.error("Process %s survived SIGKILL after %s", process_pid, self.timeout)
if returncode is None:
returncode = self.process.returncode
if error and returncode:
logger.error("Process %s cmdline: %s ended with returncode %s", process_pid, cmdline, returncode)
elif returncode != 0:
logger.debug("Process %s ended with returncode %s", process_pid, returncode)
def stop(self):
if hasattr(self, 'process'):
self.stopProcess(self.process.pid)
delattr(self, "process")
def loadSettings(self, hostname, port, path_run_dir, **kwargs):
......
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