Transfer gevent errors to log file

Transfer warnings from warnings module to logfile (#2394)
This commit is contained in:
Ozzie Isaacs 2022-05-09 19:47:43 +02:00
parent fbac3e38ac
commit 8a6a8dcbe8
2 changed files with 2 additions and 0 deletions

View File

@ -159,6 +159,7 @@ def setup(log_file, log_level=None):
r.removeHandler(h)
h.close()
r.addHandler(file_handler)
logging.captureWarnings(True)
return "" if log_file == DEFAULT_LOG_FILE else log_file

View File

@ -204,6 +204,7 @@ class WebServer(object):
output = _readable_listen_address(self.listen_address, self.listen_port)
log.info('Starting Gevent server on %s', output)
self.wsgiserver = WSGIServer(sock, self.app, log=self.access_logger, handler_class=MyWSGIHandler,
error_log=log,
spawn=Pool(), **ssl_args)
if ssl_args:
wrap_socket = self.wsgiserver.wrap_socket