Uwsgi - unable to see trace in log file

I am using uwsgi to start a small service written in flask.

I run 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

      

This seems to work, but I just hit 500 errors during the request and I want to see the traceback that the flask has generated, but I can't find it. Do I need different logging options?

Here's everything 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)

      

+3


source to share


2 answers


Ok @ipinak was on the right track. It looks like Flask is eating up the bug and not propagating it.

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



from flask import Flask
application = Flask(__name__)
application.config['PROPAGATE_EXCEPTIONS'] = True

      

+6


source


I don't think you can do it there, you need to add registration inside your application (this is what I am doing). Here is some information about the data you can log https://uwsgi-docs.readthedocs.org/en/latest/LogFormat.html?highlight=log . Also, I suggest you remove the parameter --daemonize

and use supervisord instead to have control over the process.



+1


source







All Articles