No handlers could be found for logger : <p>I am newbie to python. I was trying logging in python and I came across <strong>No handlers could be found for logger</strong> error while trying to print some warning through logger instance. Below is the code I tried</p>

<pre><code>import logging
logger=logging.getLogger('logger')
logger.warning('The system may break down')
</code></pre>

<p>And I get this error <strong>No handlers could be found for logger "logger"</strong></p>

<p>What's confusing me is when I first try to print warning using <code>logging</code> and then through <code>logger</code> , it works fine, like</p>

<pre><code>&gt;&gt;&gt; import logging
&gt;&gt;&gt; logging.warning('This is a WARNING!!!!')
WARNING:root:This is a WARNING!!!!
&gt;&gt;&gt; 
&gt;&gt;&gt; logger.warning('WARNING!!!!')
WARNING:logger:WARNING!!!!
</code></pre>

<p>Can someone throw some light on what's happening in second scenario? </p>
