mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
fix logging in file in daemon mode. error spotted by @jbergstroem and
fixed with help of @asenchi
This commit is contained in:
parent
b0250cbb5e
commit
54357b3487
@ -69,7 +69,7 @@ def daemonize():
|
|||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
maxfd = util.get_maxfd()
|
maxfd = util.get_maxfd()
|
||||||
|
|
||||||
# Iterate through and close all file descriptors.
|
# Iterate through and close all file descriptors.
|
||||||
for fd in range(0, maxfd):
|
for fd in range(0, maxfd):
|
||||||
try:
|
try:
|
||||||
@ -77,6 +77,7 @@ def daemonize():
|
|||||||
except OSError: # ERROR, fd wasn't open to begin with (ignored)
|
except OSError: # ERROR, fd wasn't open to begin with (ignored)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
os.open(util.REDIRECT_TO, os.O_RDWR)
|
os.open(util.REDIRECT_TO, os.O_RDWR)
|
||||||
os.dup2(0, 1)
|
os.dup2(0, 1)
|
||||||
os.dup2(0, 2)
|
os.dup2(0, 2)
|
||||||
@ -85,7 +86,7 @@ def main(usage, get_app):
|
|||||||
parser = op.OptionParser(usage=usage, option_list=options(),
|
parser = op.OptionParser(usage=usage, option_list=options(),
|
||||||
version="%prog " + __version__)
|
version="%prog " + __version__)
|
||||||
opts, args = parser.parse_args()
|
opts, args = parser.parse_args()
|
||||||
configure_logging(opts)
|
|
||||||
|
|
||||||
app = get_app(parser, opts, args)
|
app = get_app(parser, opts, args)
|
||||||
workers = opts.workers or 1
|
workers = opts.workers or 1
|
||||||
@ -116,6 +117,7 @@ def main(usage, get_app):
|
|||||||
daemonize()
|
daemonize()
|
||||||
else:
|
else:
|
||||||
os.setpgrp()
|
os.setpgrp()
|
||||||
|
configure_logging(opts)
|
||||||
arbiter.run()
|
arbiter.run()
|
||||||
|
|
||||||
def paste_server(app, global_conf=None, host="127.0.0.1", port=None,
|
def paste_server(app, global_conf=None, host="127.0.0.1", port=None,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user