title: Logging to two different .log files
body: <p>I would like to put the request logs in different files. Unfortunately, the code below actually creates 2 different .log files, but all the logs end up in the first and the second is completely empty. Can basicConfig be set up so that logs land in different files?</p>
  <pre><code>import logging
  import time
  
  def example_request_handler(name):
      logging.basicConfig(
          level=logging.INFO,
          format=&quot;%(asctime)s [%(levelname)s] %(message)s&quot;,
          handlers=[
              logging.FileHandler(f&quot;{name}.log&quot;),
              logging.StreamHandler()])
      logging.info(name)
  
  example_request_handler(&quot;first_request1&quot;)
  example_request_handler(&quot;secound_request2&quot;)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/NvLmk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NvLmk.png" alt="enter image description here" /></a></p>