Skip to content
Browse files

Change logging in handle_error.

  • Loading branch information...
1 parent 4a01269 commit ac223ae639658643abaeda0abea9cd206de7b13c @sirkonst sirkonst committed with tilgovi Mar 27, 2012
Showing with 12 additions and 6 deletions.
  1. +12 −6 gunicorn/workers/base.py
View
18 gunicorn/workers/base.py
@@ -126,12 +126,6 @@ def handle_exit(self, sig, frame):
sys.exit(0)
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,
InvalidHTTPVersion, InvalidHeader, InvalidHeaderName,)):
@@ -151,6 +145,18 @@ def handle_error(self, client, exc):
elif isinstance(exc, LimitRequestHeaders):
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:
tb = traceback.format_exc()
mesg += "<h2>Traceback:</h2>\n<pre>%s</pre>" % tb

0 comments on commit ac223ae

Please sign in to comment.
Something went wrong with that request. Please try again.