title: Customize logging for external/third-party libs
body: <p>I followed the advice of the django docs, and use logging like this:</p>
  
  <pre><code>import logging
  logger = logging.getLogger(__name__)
  
  def today(...):
      logger.info('Sun is shining, the weather is sweet')
  </code></pre>
  
  <p>With my current configuration, the output looks like this:</p>
  
  <pre><code>2016-08-11 14:54:06 mylib.foo.today: INFO Sun is shining, the weather is sweet
  </code></pre>
  
  <p>Unfortunately some libraries which I can't modify use logging like this:</p>
  
  <pre><code>import logging
  
  def third_party(...):
      logging.info('Make you want to move your dancing feet')
  </code></pre>
  
  <p>The output unfortunately looks like this:</p>
  
  <pre><code>2016-08-09 08:28:04 root.third_party: INFO Make you want to move your dancing feet
  </code></pre>
  
  <p>I want to see this:</p>
  
  <pre><code>2016-08-09 08:28:04 other_lib.some_file.third_party: INFO Make you want to move your dancing feet
  </code></pre>
  
  <p>Difference: </p>
  
  <p><em>root.third_party</em> ==> <em>other_lib.some_file.third_party</em></p>
  
  <p>I want to see the long version (not <code>root</code>) if code uses <code>logging.info()</code> instead of <code>logger.info()</code></p>
  
  <p><strong>Update</strong></p>
  
  <p>This is not a duplicate of <a href="https://stackoverflow.com/questions/1598823/elegant-setup-of-python-logging-in-django">Elegant setup of Python logging in Django</a>, since the solution of it is:</p>
  
  <p>Start of quote</p>
  
  <p>In each module, I define a logger using</p>
  
  <pre><code>logger = logging.getLogger(__name__)
  </code></pre>
  
  <p>End of quote.</p>
  
  <p>No, I won't modify third-party-code which uses <code>logging.info()</code> instead of <code>logger.info()</code>.</p>
  
  <p><strong>Follow Up Question</strong></p>
  
  <p><a href="https://stackoverflow.com/questions/38952681/">Avoid <code>logger=logging.getLogger(__name__)</code> without loosing way to filter logs</a></p>