title: uWSGI / Flask / Python logs stop after some time
body: <p>I have a uWSGI / Flask setup using python loggers. Though logs only from some workers get to the logs and after some time even those cease to show up at all. My hypothesis is that when uWSGI restarts (clones) workers, logging somehow gets broken. Any ideas?</p>
  
  <p><code>app/server.py</code>:</p>
  
  <pre><code>app = Flask(...)
  handler = logging.StreamHandler()
  app.logger.addHandler(handler)
  app.run()
  </code></pre>
  
  <p>uWSGI:</p>
  
  <pre><code>uwsgi --emperor /etc/uwsgi/apps-enabled/*.ini --die-on-term --uid www-data --gid www-data --logto /var/www/app.com/logs/uwsgi/emperor.log --socket /tmp/uwsgi/emperor.sock --enable-threads --master --single-interpreter --log-reopen --chmod-socket=770
  </code></pre>
  
  <p>apps-enabled/app-0.ini and apps-enabled/app-1.ini look like this:</p>
  
  <pre><code>module=server:app
  enable-threads=true
  single-interpreter=true
  master=true
  chdir=/var/www/app.com/app
  env=APPLICATION_ENVIRONMENT=production
  venv=/var/www/app.com/virtualenv
  
  logto=/var/www/app.com/logs/uwsgi/app.com-0.log
  log-reopen=true
  chmod-socket=770
  buffer-size=65535
  
  lazy-apps=true
  max-requests=5000
  heartbeat=15
  
  for=0 1 2 3 4 5 6 7
  socket=/tmp/uwsgi/app.0.%(_).sock
  endfor=
  
  processes=8
  
  map-socket=0:1
  map-socket=1:2
  map-socket=2:3
  map-socket=3:4
  map-socket=4:5
  map=socket=5:6
  map=socket=6:7
  map=socket=7:8
  </code></pre>
  
  <p>I have also tried to use <code>SysLogHandler</code> with the same result. </p>