How to force application's stdout logs through

2019-06-17 02:01发布

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.

1条回答
We Are One
2楼-- · 2019-06-17 02:33

use

log-master=true

in your uwsgi-conf.ini or

--log-master

if you pass it as param

查看更多
登录 后发表回答