don't send wsgi.errors twice and remove spurious print

This commit is contained in:
benoitc 2014-01-01 16:27:06 +01:00
parent ee08ac8644
commit 640bf42206

View File

@ -47,18 +47,17 @@ class WSGIErrorsWraper(io.RawIOBase):
def __init__(self, cfg):
errorlog = logging.getLogger("gunicorn.error")
handlers = errorlog.handlers
self.streams = []
if cfg.errorlog == "-":
self.streams.append(sys.stderr)
handlers = handlers[1:]
for h in errorlog.handlers:
for h in handlers:
if hasattr(h, "stream"):
self.streams.append(h.stream)
if not self.streams:
self.streams.append(sys.stderr)
def write(self, data):
for stream in self.streams:
try:
@ -191,8 +190,6 @@ def create(req, sock, client, server, cfg):
# override the environ with the correct remote and server address if
# we are behind a proxy using the proxy protocol.
environ.update(proxy_environ(req))
print(environ)
return resp, environ