How to force application's stdout logs through uwsgi?

穿精又带淫゛_ 提交于 2019-12-23 07:22:28

问题


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:


use

log-master=true

in your uwsgi-conf.ini or

--log-master

if you pass it as param



来源:https://stackoverflow.com/questions/35511839/how-to-force-applications-stdout-logs-through-uwsgi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!