How to log into Jupyter notebook's console instead of webpage after version 4.1.1
<p>In version 4.1.0:</p>

<pre><code>import logging
r = logging.getLogger()
r.setLevel(logging.DEBUG)
logging.debug("debug")
</code></pre>

<p>will log into the console/terminal.<br>
And we can get a default <code>StreamHandler</code> by:
<code>stream_handler = root.handlers[0]</code></p>

<p>But in 4.1.1, the handler is missing and the code above will log to the webpage.</p>

<p>I can not find the release note or changelog of 4.1.1.</p>

<p>How can I log into console in the latest version of jupyter notebook?</p>

<p>The solution is add the standard output unit by myself.</p>

<pre><code>root = logging.getLogger()
root.addHandler(logging.StreamHandler(os.fdopen(1, "w")))
</code></pre>

<p>now, <code>logging.debug</code> log into the console</p>

python logging jupyter jupyter-notebook