From 3e32ce576ca396c37d7f25cdb5575f377746cf0d Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Fri, 9 Oct 2020 15:26:01 -0500 Subject: [PATCH] Cleanup for log_json review --- notebook/log.py | 3 --- notebook/notebookapp.py | 3 +-- notebook/utils.py | 4 ---- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/notebook/log.py b/notebook/log.py index 46cd93585..027897f8c 100644 --- a/notebook/log.py +++ b/notebook/log.py @@ -46,8 +46,5 @@ def log_request(handler, log=access_log): if status >= 500 and status != 502: # log all headers if it caused an error log_method(json.dumps(dict(request.headers), indent=2)) - # if _enable_json_logs: - # log_method(ns) - # else: log_method(msg.format(**ns)) prometheus_log_method(handler) diff --git a/notebook/notebookapp.py b/notebook/notebookapp.py index 6920866be..2d0164d25 100755 --- a/notebook/notebookapp.py +++ b/notebook/notebookapp.py @@ -114,7 +114,6 @@ from notebook._sysinfo import get_sys_info from ._tz import utcnow, utcfromtimestamp from .utils import ( check_pid, - enable_json_logs, pathname2url, run_sync, unix_socket_in_use, @@ -720,7 +719,7 @@ class NotebookApp(JupyterApp): @default('log_json') def _default_log_json(self): """Get the log_json value from the environment.""" - return enable_json_logs() + return os.getenv('JUPYTER_ENABLE_JSON_LOGGING', 'false').lower() == 'true' @validate('log_json') def _validate_log_json(self, proposal): diff --git a/notebook/utils.py b/notebook/utils.py index 5f3f70164..1196d6d89 100644 --- a/notebook/utils.py +++ b/notebook/utils.py @@ -401,7 +401,3 @@ def unix_socket_in_use(socket_path): return True finally: sock.close() - - -def enable_json_logs(): - return os.getenv('JUPYTER_ENABLE_JSON_LOGGING', 'false').lower() == 'true'