How to see error for python application in gunicorn
<p>I have <a href="https://falcon.readthedocs.io/en/stable/index.html" rel="nofollow">falcon</a> application which is run with gunicorn. If there are errors in .py file it gives traceback, but in grunicorn it sends to console only:</p>

<pre><code>[2016-09-02 17:39:26 +0300] [6927] [INFO] Starting gunicorn 19.6.0
[2016-09-02 17:39:26 +0300] [6927] [INFO] Listening at: http://127.0.0.1:8000 (6927)
[2016-09-02 17:39:26 +0300] [6927] [INFO] Using worker: sync
[2016-09-02 17:39:26 +0300] [6930] [INFO] Booting worker with pid: 6930
</code></pre>

<p>And the only error output is:</p>

<pre><code>[2016-09-02 17:39:29 +0300] [6927] [INFO] Shutting down: Master
[2016-09-02 17:39:29 +0300] [6927] [INFO] Reason: Worker failed to boot.
</code></pre>

<p>How to get full error output? I need to know what causes worker to fail to boot.</p>

<p>This is a problem with gunicorn log (not falcon). Sometimes it won't output the exception that generated the boot failure. So to debug my WSGI <code>app</code> what I usually do is to run the server with the test server provided by <code>wsgiref</code> as follows:</p>

<pre><code>from wsgiref import simple_server

if __name__ == '__main__':
    APP_HOST = 8080 #you may want to change this
    APP_HOST = '0.0.0.0' #you may want to change this
    httpd = simple_server.make_server(APP_HOST, APP_PORT, app)
    httpd.serve_forever()
</code></pre>

<p>This should help you figure out where's the problem.</p>

python error-handling gunicorn falconframework