title: Setup logging before importing other modules
body: <p>What is the standard way for setting up the logging system (formatting, level), <em>before</em> modules are imported?</p>
  <p>The reason I want to do this is that during the import phase complex data structures are loaded, and progress is shown with loggers. But since the logging level is not set, I do not even see those log entries (level is by default <code>WARNING</code>)</p>
  <p>I could do a hack like this:</p>
  <pre><code>import logging
  
  logging.basicConfig(...)
  
  import mymodule
  </code></pre>
  <p>But I do not like running code before importing stuff.</p>
  <p>Isn't there an accepted way to &quot;pre-configure&quot; the logging system from outside the application, with env variables or any such alternative? Something like:</p>
  <pre><code>LOG_LEVEL=INFO LOG_FORMAT=&quot;...&quot; python main.py
  </code></pre>
  <p>I can of course evaluate those env vars myself (and at that point my hack above is good enough), but I would like to reuse existing ideas before implementing my own solution.</p>