mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Change logging in handle_error.
This commit is contained in:
parent
4a01269871
commit
ac223ae639
@ -126,12 +126,6 @@ class Worker(object):
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
def handle_error(self, client, exc):
|
def handle_error(self, client, exc):
|
||||||
self.log.exception("Error handling request")
|
|
||||||
|
|
||||||
status_int = 500
|
|
||||||
reason = "Internal Server Error"
|
|
||||||
mesg = ""
|
|
||||||
|
|
||||||
if isinstance(exc, (InvalidRequestLine, InvalidRequestMethod,
|
if isinstance(exc, (InvalidRequestLine, InvalidRequestMethod,
|
||||||
InvalidHTTPVersion, InvalidHeader, InvalidHeaderName,)):
|
InvalidHTTPVersion, InvalidHeader, InvalidHeaderName,)):
|
||||||
|
|
||||||
@ -151,6 +145,18 @@ class Worker(object):
|
|||||||
elif isinstance(exc, LimitRequestHeaders):
|
elif isinstance(exc, LimitRequestHeaders):
|
||||||
mesg = "<p>Error parsing headers: '%s'</p>" % str(exc)
|
mesg = "<p>Error parsing headers: '%s'</p>" % str(exc)
|
||||||
|
|
||||||
|
self.log.debug("Invalid request from ip={ip}: {error}"\
|
||||||
|
"".format(ip=client.getpeername()[0],
|
||||||
|
error=repr(exc),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
self.log.exception("Error handling request")
|
||||||
|
|
||||||
|
status_int = 500
|
||||||
|
reason = "Internal Server Error"
|
||||||
|
mesg = ""
|
||||||
|
|
||||||
if self.debug:
|
if self.debug:
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
mesg += "<h2>Traceback:</h2>\n<pre>%s</pre>" % tb
|
mesg += "<h2>Traceback:</h2>\n<pre>%s</pre>" % tb
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user