Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uwsgi - can't see traceback in log file

I'm using uwsgi to run a small service written in flask.

I launch it like this:

flask/bin/uwsgi --http :9090 --master --pidfile /tmp/KVAutobus-uwsgi.pid  --processes 30 --threads 2 --wsgi-file app.py --callable app --stats :9191 --daemonize /opt/logs/KVAutobus-uwsgi.log

It seems to work, but I just hit a 500 error during a request and I want to see the traceback that the flask app produced but I can't find it. Do I need different logging options?

Here's all that's in the log file after the 500 error:

>tail /opt/logs/KVAutobus-uwsgi.log

*** Stats server enabled on :9191 fd: 135 ***
spawned uWSGI http 1 (pid: 20124)
[pid: 20060|app: 0|req: 1/1] 10.36.100.18 () {34 vars in 709 bytes} [Tue Jun 30 14:29:57 2015] DELETE /kvautobus/api/clear_cache_range/MDAwMDAwMDA1NTA0MDAwMDAwMDQwOTYwMDAwMDAwMTczMDU2/MDAwMDAwMDA1NTA0MDAwMDAwMDQwOTYwMDAwMDAwMTg0NDQ4/ => generated 291 bytes in 30023 msecs (HTTP/1.1 500) 2 headers in 84 bytes (1 switches on core 0)
like image 494
Greg Avatar asked Feb 09 '23 17:02

Greg


1 Answers

Ok, @ipinak was on the right track. It looks like Flask is gobbling up the error and not propagating it.

Here's the answer I found that fixes it. If the link breaks, it's basically setting this in your app:

from flask import Flask
application = Flask(__name__)
application.config['PROPAGATE_EXCEPTIONS'] = True
like image 81
Greg Avatar answered Feb 12 '23 07:02

Greg