Stream jupyter server logs to a file

By streaming the logs also to a file users can access them from inside
the container which helps them debug issues without having to ask an
admin.
pull/987/head
Tim Head 2020-11-25 11:29:20 +01:00
rodzic f3229c1fd5
commit 3dd2b8652d
1 zmienionych plików z 10 dodań i 2 usunięć

Wyświetl plik

@ -2,11 +2,19 @@
# lightest possible entrypoint that ensures that
# we use a login shell to get a fully configured shell environment
# (e.g. sourcing /etc/profile.d, ~/.bashrc, and friends)
# Setup a file descriptor (FD) that is connected to a tee process which
# writes its input to $REPO_DIR/.jupyter-server-log.txt
# We later use this FD as a place to redirect the output of the actual
# command to. We can't add `tee` to the command directly as that will prevent
# the container from exiting when `docker stop` is run.
exec {log_fd}> >(exec tee $REPO_DIR/.jupyter-server-log.txt)
if [[ ! -z "${R2D_ENTRYPOINT:-}" ]]; then
if [[ ! -x "$R2D_ENTRYPOINT" ]]; then
chmod u+x "$R2D_ENTRYPOINT"
fi
exec "$R2D_ENTRYPOINT" "$@"
exec "$R2D_ENTRYPOINT" "$@" >&"$log_fd" 2>&1
else
exec "$@"
exec "$@" >&"$log_fd" 2>&1
fi