Merge pull request #2315 from benoitc/more-verbose-exit-logging

More verbose exit logging
This commit is contained in:
Benoit Chesneau 2023-05-07 16:28:49 +02:00 committed by GitHub
commit 5de82ce781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -340,9 +340,12 @@ class Arbiter(object):
def halt(self, reason=None, exit_status=0):
""" halt arbiter """
self.stop()
self.log.info("Shutting down: %s", self.master_name)
log_func = self.log.info if exit_status == 0 else self.log.error
log_func("Shutting down: %s", self.master_name)
if reason is not None:
self.log.info("Reason: %s", reason)
log_func("Reason: %s", reason)
if self.pidfile is not None:
self.pidfile.unlink()
self.cfg.on_exit(self)
@ -520,6 +523,8 @@ class Arbiter(object):
# that it could not boot, we'll shut it down to avoid
# infinite start/stop cycles.
exitcode = status >> 8
if exitcode != 0:
self.log.error('Worker (pid:%s) exited with code %s', wpid, exitcode)
if exitcode == self.WORKER_BOOT_ERROR:
reason = "Worker failed to boot."
raise HaltServer(reason, self.WORKER_BOOT_ERROR)