From 8a6a8dcbe8dd86b4673d72d255867e51caebfaa3 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 9 May 2022 19:47:43 +0200 Subject: [PATCH] Transfer gevent errors to log file Transfer warnings from warnings module to logfile (#2394) --- cps/logger.py | 1 + cps/server.py | 1 + 2 files changed, 2 insertions(+) diff --git a/cps/logger.py b/cps/logger.py index fcc25c27..82853bba 100644 --- a/cps/logger.py +++ b/cps/logger.py @@ -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 diff --git a/cps/server.py b/cps/server.py index 0ffdbd18..fb70a723 100644 --- a/cps/server.py +++ b/cps/server.py @@ -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