Reputation: 2124
I'm doing a small research on IPython kernel and trying to get debug logs out of it and see how it interacts with a notebook. Now it looks like the documentation and example configs shipped in my distribution is totally outdated.
Please read this section before giving links to the official docs
First I created profiles for both IPython and notebook with the following commands:
$ ipython profile create
$ jupyter notebook --generate-config
As expected three files where created:
In these files I found similar commented fragments:
# Set the log level by value or name.
# c.Application.log_level = 0
I tried to uncomment it in the jupyter config. Instead of adding more details it totally disabled console output for the jupyter
process. I also tried value 50
it has the same result, value DEBUG
gave me Python error on start.
I also played with these values in ipython's configs but I wasn't able to find log files location.
In mail list command line option --log-level=DEBUG
is mentioned and indeed it works for jupyter. But I really want to persist this setting in a profile and have debug info for the kernel too.
Config options NotebookApp.log_level
and IPKernelApp.log_level
also change nothing.
Upvotes: 20
Views: 74952
Reputation: 1015
Here are the steps I recommend
Find the python bin/exe that you kernel use. You should be able to find it in your kernel file or you can see it from your jupyter notebook log. For example, from the log below, you can see that it is /opt/anaconda3/envs/ray_python39/bin/python
[D 09:12:21.717 NotebookApp] Starting kernel: ['/opt/anaconda3/envs/ray_python39/bin/python', '-m', 'ipykernel_launcher', '-f', 'Library/Jupyter/runtime/kernel-c106812b-d169-43bd-b305-159235683941.json']
Run the python execution using the path found in step 1. Then run your code, it will tell you exactly why the kernel failed.
Upvotes: 0
Reputation: 5626
I believe that this kind of functionality is still on the wishlist:
https://github.com/ipython/ipython/issues/8570
But you could try something like this:
jupyter notebook --debug > log.file 2>&1
or
ipykernel kernel --debug > log.file 2>&1
Upvotes: 20
Reputation: 41
You can also try to start ipython kernel without attached frontend with option --debug:
ipython kernel --debug
You can get lot of info about interaction between kernel and the forntend by setting c.Session.debug = True
in jupyter_notebook_config.py
.
Upvotes: 4