Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force application's stdout logs through uwsgi?

I have Django application running behind uwsgi inside Docker container. uwsgi is started via ENTRYPOINT and CMD parameters in Dockerfile. I succesfully connect it to separated Nginx container and check expected results in browser.

So far, so good.

Now I would like see application logs in Django container. But I am not able to find right combination of Django's settings LOGGING variable and uwsgi switches. I just see uwsgi standard logs which is useless for me.

Is it possible at all? It seems to me, that I must make some wrapper BASH script, like:

uwsgi --socket 0.0.0.0:80 --die-on-term --module myapp.wsgi:application --chdir /src --daemonize /dev/null
tail -f /common.log```

... set LOGGING inside Django to write into /common.log and tail it to output.

Is there some more elegant solution?

Updated 2016-02-24:

Yes, it is possible. I made mistake somewhere in my first tests. I published working example on https://github.com/msgre/uwsgi_logging.

like image 671
msgre Avatar asked Feb 19 '16 18:02

msgre


1 Answers

use

log-master=true

in your uwsgi-conf.ini or

--log-master

if you pass it as param

like image 177
Alexandru R Avatar answered Sep 28 '22 03:09

Alexandru R