From 92d551dcc617c0c24bd339cbfd163fb2f771caab Mon Sep 17 00:00:00 2001 From: Fredrik Svantes Date: Thu, 29 Aug 2024 09:49:52 +0200 Subject: [PATCH] Only log to file if LOG_FILE is set Otherwise log to stdout --- server.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index cbe3a88..814b7b4 100644 --- a/server.py +++ b/server.py @@ -33,8 +33,11 @@ app.config['MAX_CONTENT_LENGTH'] = 15 * 1024 * 1024 # 15 Mb limit recaptcha = ReCaptcha(app) -app.config['LOG_FILE'] = 'secure-drop.log' -logging.basicConfig(filename=app.config['LOG_FILE'], level=logging.INFO) +log_file = os.environ.get('LOG_FILE', '') +if log_file: + logging.basicConfig(filename=log_file, level=logging.INFO) +else: + logging.basicConfig(level=logging.INFO) def parse_form(form): text = form['message']