title: Configuring the logging of a third party script
body: <p>I have a third party python console script, which source I don't want to modify.</p>
  
  <p>But I want to configure the logging which is done by the script and its libraries. The script uses the standard python logging, but does not support configuration of it.</p>
  
  <p>The script uses this pattern:</p>
  
  <pre><code>import logging
  logger=logging.getLogger(__name__)
  </code></pre>
  
  <p>Use cases: </p>
  
  <ul>
  <li>I want INFO messages of file foo.py to be ignored.</li>
  <li>I want to include the PID in the loggings messages.</li>
  </ul>
  
  <p>How can I configure the logging, if I don't want to modify the sources of the console script?</p>
  
  <p>The script gets called via <code>cron</code>.</p>
  
  <p>How can I configure the logging if this script?</p>
  
  <h1>Important</h1>
  
  <p>Creating a wrapper script like in <a href="https://stackoverflow.com/questions/23711400/settings-up-logging-in-console-script">this answer</a> is not a solution for me.</p>
  
  <p>The linux process hierarchy looks like this:</p>
  
  <pre><code>Cron -&gt; third_party_script
  </code></pre>
  
  <p>There should be any "glue", "wrapping" or "dirty-hack" script between cron and <code>third_party_script</code>.</p>
  
  <h1>Why obtrusive/netpicking?</h1>
  
  <p>I want to practice "separation of concerns". I want to be able to configure logging one time and in one place. This configuration should get used by all python code of a virtualenv. Writing a wrapper would be a work-around. I want a solution.</p>
  
  <h1>Update</h1>
  
  <p>Several months later I think a pth file would an simple answer.</p>