jupyter / help

:sparkles: Need some help or have some questions? Please visit our Discourse page.
https://discourse.jupyter.org
291 stars 97 forks source link

Per-user rotating file logs in Jupyter Hub with sudo spawner #85

Open parente opened 8 years ago

parente commented 8 years ago

I'd like to have all output from each Jupyter Hub user notebook server and the kernels it launches log to a separate, rotating log file on disk. Has anyone got a recipe for doing it? I'll concoct something if not, but figured I'd ask first.

The best I can think of at the moment is to have every user put a jupyter_notebook_config.py in his/her home directory with a bunch of Python configuring the trailtlets.log.get_logger(), but this is not ideal since it's prone to user override and error.

minrk commented 8 years ago

I've shied away from adding this level of configurability in our Python applications themselves, as service-running tools often have their own mechanism for sending logs to syslog, what have you. For instance, docker has logging drivers, and supervisor/systemd can use syslog, etc. as well, without the Hub or notebook server needing to know anything about it.

What Spawner are you using?

yuvipanda commented 8 years ago

If you use the systemd spawner, all users' logs go into journald as well.

On Thu, Sep 29, 2016 at 8:14 AM, Min RK notifications@github.com wrote:

I've shied away from adding this level of configurability in our Python applications themselves, as service-running tools often have their own mechanism for sending logs to syslog, what have you. For instance, docker has logging drivers https://docs.docker.com/engine/admin/logging/overview/, and supervisor/systemd can use syslog, etc. as well, without the Hub or notebook server needing to know anything about it.

What Spawner are you using?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jupyter/help/issues/85#issuecomment-250496329, or mute the thread https://github.com/notifications/unsubscribe-auth/AAB23qn57vQBLg0piIfWQD3ZX09Odujiks5qu9XlgaJpZM4KIXyE .

Yuvi Panda T http://yuvi.in/blog

parente commented 8 years ago

What Spawner are you using?

My fault for not saying it up front: sudo spawner

What I settled on for the moment is swapping in my own singleuser script with one that redirects everything from the notebook process to a file owned by the same user as the notebook server and located in a directory managed by logrotate. It works OK.