diff --git a/swift/common/daemon.py b/swift/common/daemon.py index 7136fb3329..59a6611890 100644 --- a/swift/common/daemon.py +++ b/swift/common/daemon.py @@ -138,7 +138,7 @@ class DaemonStrategy(object): def kill_children(*args): self.running = False - self.logger.info('SIGTERM received') + self.logger.notice('SIGTERM received (%s)', os.getpid()) signal.signal(signal.SIGTERM, signal.SIG_IGN) os.killpg(0, signal.SIGTERM) os._exit(0) diff --git a/swift/common/wsgi.py b/swift/common/wsgi.py index bce576fa5e..eb5c0ffe26 100644 --- a/swift/common/wsgi.py +++ b/swift/common/wsgi.py @@ -1163,7 +1163,7 @@ def run_wsgi(conf_path, app_section, *args, **kwargs): logger.error('Stopping with unexpected signal %r' % running_context[1]) else: - logger.error('%s received (%s)', signame, os.getpid()) + logger.notice('%s received (%s)', signame, os.getpid()) if running_context[1] == signal.SIGTERM: os.killpg(0, signal.SIGTERM) elif running_context[1] == signal.SIGUSR1: diff --git a/test/unit/common/test_daemon.py b/test/unit/common/test_daemon.py index 2f0549abbb..44c864b00e 100644 --- a/test/unit/common/test_daemon.py +++ b/test/unit/common/test_daemon.py @@ -139,6 +139,7 @@ class TestRunDaemon(unittest.TestCase): with mock.patch('swift.common.daemon.os') as mock_os: func() self.assertEqual(mock_os.method_calls, [ + mock.call.getpid(), mock.call.killpg(0, signal.SIGTERM), # hard exit because bare except handlers can trap SystemExit mock.call._exit(0)