Cleanup for log_json review

Matt Riedemann 6 years ago
parent 6a74393f95
commit 3e32ce576c

@ -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)

@ -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):

@ -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'

Loading…
Cancel
Save