Skip to content

Commit

Permalink
Merge pull request #2315 from benoitc/more-verbose-exit-logging
Browse files Browse the repository at this point in the history
More verbose exit logging
  • Loading branch information
benoitc committed May 7, 2023
2 parents 400d847 + 79fc9a3 commit 5de82ce
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gunicorn/arbiter.py
Expand Up @@ -340,9 +340,12 @@ def wakeup(self):
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)
Expand Down Expand Up @@ -520,6 +523,8 @@ def reap_workers(self):
# 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)
Expand Down

0 comments on commit 5de82ce

Please sign in to comment.