diff --git a/jupyterhub/singleuser/extension.py b/jupyterhub/singleuser/extension.py index f5e2f197..3859b6a9 100644 --- a/jupyterhub/singleuser/extension.py +++ b/jupyterhub/singleuser/extension.py @@ -617,7 +617,9 @@ class JupyterHubSingleUser(ExtensionApp): app.web_app.settings[ "page_config_hook" ] = app.identity_provider.page_config_hook - app.web_app.settings["log_function"] = log_request + # if the user has configured a log function in the tornado settings, do not override it + if not 'log_function' in app.config.ServerApp.get('tornado_settings', {}): + app.web_app.settings["log_function"] = log_request # add jupyterhub version header headers = app.web_app.settings.setdefault("headers", {}) headers["X-JupyterHub-Version"] = __version__ diff --git a/jupyterhub/singleuser/mixins.py b/jupyterhub/singleuser/mixins.py index 723ff961..8ab43d36 100755 --- a/jupyterhub/singleuser/mixins.py +++ b/jupyterhub/singleuser/mixins.py @@ -669,7 +669,8 @@ class SingleUserNotebookAppMixin(Configurable): # load the hub-related settings into the tornado settings dict self.init_hub_auth() s = self.tornado_settings - s['log_function'] = log_request + # if the user has configured a log function in the tornado settings, do not override it + s.setdefault('log_function', log_request) s['user'] = self.user s['group'] = self.group s['hub_prefix'] = self.hub_prefix