Open peter9477 opened 9 years ago
FWIW, here's my workaround for this issue. Not a complete example, but it shows the relevant parts.
import bottle
import gevent.pywsgi
_WSGIServer = gevent.pywsgi.WSGIServer
class GeventWSGIServer(_WSGIServer):
def __init__(self, *args, **kwargs):
"""
XXX: workaround for https://github.com/bottlepy/bottle/issues/725
"""
kwargs['log'] = kwargs['access_log']
del kwargs['access_log']
_WSGIServer.__init__(self, *args, **kwargs)
gevent.pywsgi.WSGIServer = GeventWSGIServer
app = bottle.Bottle()
bottle.run(
app,
server=bottle.GeventServer,
handler_class=gevent.pywsgi.WSGIHandler,
access_log=logging.getLogger(__name__)
)
Pull requests welcome.
The current code in GeventServer effectively ignores a keyword arg of "log", overwriting it either with "default" or None depending on the state of "self.quiet".
The expected behavior is that if self.quiet is not true, a log argument can be passed down to the WSGIServer. WSGIServer already has
log="default"
in its keyword args so the adapter doesn't need to, and should not, supply this explicitly itself.Current code:
Suggested new code:
Edit: I should note, this applies to bottle 0.12 (and the latest code in master), and gevent 1.0.1. Earlier gevent (I checked 5c11789cabcc0cf737313cb0fdcb727a8dc38629 from 2011) would output to stderr if "log=None" so the current code in bottle would be broken for that version anyway (i.e. quiet=True would not actually silence the log output).