UWSGI send logs to multiple locations

5/5/2020

I'm a bit new to uwsgi so this may be a dumb question, I'm trying to get uwsgi to write logs to multiple locations and have not been able to find a way to do this.

I'm want to setup uwsgi so it writes to both my logfile (/tmp/uwsgi.log) and stdout (so I can see it in the logs in my k8s pod). But I can't get both to work. I can only get one or the other to work. Here is my uwsgi.ini file:

[uwsgi]
root = %d/../test
chdir = %(root)
module=test.wsgi:application
socket=/tmp/uwsgi_test.sock
master=True
pidfile=/tmp/uwsgi_test.pid
vacuum=True
max-requests=2000
logto=/tmp/uwsgi.log
chmod-socket = 666
vacuum = true
processes = %(%k * 4)
enable-threads = True
single-interpreter = True
limit-as = 4056
buffer-size=65535
stats=/tmp/uwsgi_test_stats.sock

Running this uwsgi file with /opt/conda/bin/uwsgi --ini /home/docker/uwsgi/k8s-sandbox-webserver.ini sends log files to only /tmp/uwsgi as specified by the logto parameter in the uwsgi.ini. If I remove the logto parameter completely then the logs only go to stdout. How can I make these uwsgi logs appear in both stdout and /tmp/uwsgi.log?

So far I've tried logto2 and and daemonize so far but haven't had any luck with getting those to work for this purpose.

-- dredbound
django
kubernetes
linux
python
uwsgi

0 Answers