I am trying to produce log output, not inside a notebook but in “backend” code, e.g. in a nbserver_extension or in a configuration file. However, code like the following produces no output:
import logging
log = logging.getLogger('MyLogger')
log.setLevel(logging.DEBUG)
log.debug("debug")
I can get output by calling basicConfig
, but then it doesn’t have the same style as Jupyter’s logging. If I call my logger NotebookApp.MyLogger
, I do get output (as it is then a child logger).
What is the proper way for third-party code in the Jupyter server to do logging? Can I use a custom logger name that doesn’t start with NotebookApp
and still use the right formatting?