I'm playing with wsgiref.simple_server to study the world of web servers.
I would like to control the log generated, but could not find anything about it in Python's documentation.
My code looks like this:
from wsgiref.simple_server import make_server
def application(environ, start_response):
start_response('200 OK', headers)
return ['Hello World']
httpd = make_server('', 8000, application)
httpd.serve_forever()
wsgiref.simple_server.make_serverby default creates aWSGIServerwithWSGIRequestHandler:WSGIRequestHandlerhere extends fromBaseHTTPServer.BaseHTTPRequestHandler, where the logging magic turns out to be:So it's logging to stderr, actually, not to python logging module. You can override this in your own handler:
And pass your custom handler to the server instead: