Merge pull request #4475 from grios-stratio/fix/custom-debug-function

Allow setting custom log_function in tornado_settings in SingleUserServer
This commit is contained in:
Min RK
2023-06-13 12:36:11 +02:00
committed by GitHub
2 changed files with 5 additions and 2 deletions

View File

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

View File

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