From 3353aa02985ef0a896660d49d7a9b5aeff4657bd Mon Sep 17 00:00:00 2001 From: "Langhammer, Jens" Date: Tue, 15 Oct 2019 15:57:37 +0200 Subject: [PATCH] root(minor): disable uwsgi request loggin and use custom logging instead --- docker/uwsgi.ini | 1 + passbook/root/wsgi.py | 18 ++++++++---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/docker/uwsgi.ini b/docker/uwsgi.ini index 464aa771f..3ce917051 100644 --- a/docker/uwsgi.ini +++ b/docker/uwsgi.ini @@ -8,3 +8,4 @@ threads = 2 enable-threads = true uid = passbook gid = passbook +disable-logging=True diff --git a/passbook/root/wsgi.py b/passbook/root/wsgi.py index 57aedca61..848d8975f 100644 --- a/passbook/root/wsgi.py +++ b/passbook/root/wsgi.py @@ -14,14 +14,12 @@ from structlog import get_logger os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passbook.root.settings") -LOGGER = get_logger() - - class WSGILogger: """ This is the generalized WSGI middleware for any style request logging. """ def __init__(self, application): self.application = application + self.logger = get_logger('passbook.wsgi') def __healthcheck(self, start_response): start_response('204 OK', []) @@ -64,13 +62,13 @@ class WSGILogger: query_string = '' if environ.get('QUERY_STRING') != '': query_string = f"?{environ.get('QUERY_STRING')}" - LOGGER.info(f"{environ.get('PATH_INFO', '')}{query_string}", - host=host, - method=environ.get('REQUEST_METHOD', ''), - protocol=environ.get('SERVER_PROTOCOL', ''), - status=status_code, - size=content_length / 1000 if content_length > 0 else '-', - runtime=kwargs.get('runtime')) + self.logger.info(f"{environ.get('PATH_INFO', '')}{query_string}", + host=host, + method=environ.get('REQUEST_METHOD', ''), + protocol=environ.get('SERVER_PROTOCOL', ''), + status=status_code, + size=content_length / 1000 if content_length > 0 else '-', + runtime=kwargs.get('runtime')) application = WSGILogger(get_wsgi_application())