It’s a bit complicated
See this post
and the follow-ups, especially about turning on debug logging and ServerApp vs NotebookApp.
ServerApp
NotebookApp