title: Atomic log file rotation with Flask and RotatingFileHandler
body: <p>I use standard <code>RotatingFileHandler</code> within my Flask application with next parameters: <code>maxBytes=10 * 1024 * 1024, backupCount=50</code>. App is managed by uWSGI behind nginx. uWSGI config file part looks like this:</p>
  
  <pre><code>processes = 16
  enable-threads = true
  threads = 10
  </code></pre>
  
  <p>Right after start of an app everything (I mean logging) works well. But after first log file rotation some processes (and maybe threads too) continue writing to rotated file and some - to new one. It is obvious. But for me it is not so obvious how can I rotate log file in the way that all of my processes (and threads) start to write messages to new file.</p>