Logging stdout with python3 and uWSGI : <p>I have a python 2 flask app running behind uWSGI, which is managed by supervisord. Logs are being written to sys.stdout by the flask app. These logs are then picked up by uWSGI and written to file by supervisord. uWSGI logs are written to /dev/stderr. See the supervisord conf below.</p>

<pre><code>[program:uwsgi]
command = uwsgi --ini /etc/uwsgi.conf --master
directory = /app
autostart = true
autorestart = true
stdout_logfile = /var/log/myapplication/application.log
stdout_logfile_maxbytes = 50000000
stdout_logfile_backups = 3
stderr_logfile = /dev/stderr
stderr_logfile_maxbytes = 0
stopsignal = INT
</code></pre>

<p>This works great! I have nicely separated application logs and uWSGI logs.</p>

<p>I've now upgraded to python 3. This has all gone fine, except the application logs are now ending up in uWSGI's stderr, mixed in with the uWSGI logs.</p>

<p>I've trawled the uWSGI docks, and have not been able to find a reason for this change between python 2 and python 3.</p>

<p>I've tried redirecting when defining the socket, like is suggested here <a href="http://lists.unbit.it/pipermail/uwsgi/2016-February/008383.html" rel="noreferrer">http://lists.unbit.it/pipermail/uwsgi/2016-February/008383.html</a> but that just redirects everything (application and uWSGI logs) to <code>/dev/null</code>.</p>

<p>I also found this <a href="http://lists.unbit.it/pipermail/uwsgi/2016-January/008353.html" rel="noreferrer">http://lists.unbit.it/pipermail/uwsgi/2016-January/008353.html</a> but could't find anything about pyimport-shared.</p>

<p>Does anyone know what might be going on?</p>

<p>My uWSGI conf is here if it help.</p>

<pre><code>[uwsgi]
uid = www-data
gid = www-data
module = application:application

socket = /run/uwsgi.sock

single-interpreter = true
enable-threads = true
buffer-size = 16384

processes = 4
</code></pre>

<p>Thanks</p>
