Logging information from hub-spawned lab servers

Is there any information available on how best to create logs from the jupyterlab servers spawned by a jupyterhub?

I administer a small jupyterhub for a few dozen end users. In all cases, we are spawning jupyterlab servers for users after logging into the hub. Currently running Jupyterhub 1.0.0 and spawning Jupyerlab 1.1.4 servers.

We’ve recently run into an issue where a user could not successfully launch a notebook inside their lab server (kernel would die). After a difficult period of debugging, we found out the user had a file called profile.py in their home dir, used for a purpose completely unrelated to Hub/Lab. Because jupyter notebook executes a stdlib import profile internally, it was instead sourcing this profile.py file and then dying when trying to run a method from that library.

The stack trace from this failed notebook (launched inside the lab server spawned by the hub) would have been useful!

Is there any way to get this kind of info percolated up and piped into a log file? I suppose in a perfect world I’d have the option of a per-user log file, but I’d settle for it in any form.

Ben Klaas
Institute for Social Research and Data Innovation
University of Minnesota

How are you running Jupyterhub and what spawner are you using?

For example if you’re using Docker an admin can fetch the logs using docker logs <users-container> and similarly for Kubernetes.

It’s not run out of a container, just on an Ubuntu server. I manage the the hub and lab in a conda environment. Spawner command is juputer-labhub.