Roberto De Ioris <roberto@...> writes:
>
> > How can i get detailed information about 500 errors originating from uWSGI
> > in
> > case if process is daemonized and there is nothing in the logs?
> >
> >
>
> This is something your app should do, if the python-side does not say what
> is going wrong to uWSGI, it cannot print nothing in the logs.
>
> Start defining an action that simply raise an exception, this exception
> should be caught by uWSGI. If not, something is wrong and we should
> investigte further.
>
Unfortunately for infrastructure level issues (in this particular case -
dealing with utf-8 in response w/o --pep3333 flag) it does not get to python at
all, so none of exception catching or logging actually matters. Normally all
raised exceptions are caught by error handling and logging facilities within
the application itself just fine.
As a test case, i intentionally raised ValueError in part of the code which
get's executed during handling of this particular request in application, the
output in uWSGI log is same as what i posted earlier - there is 500 error and
nothing else, however if i use console-hack instead of uWSGI, which is this
script basically:
from io import StringIO
import urllib.parse
import query
def output(msg, body):
print(msg)
for line in body: print(line)
request = 'ListPersonsByLastnameLike'
data = '{"lastname":"кин"}'
urldata = urllib.parse.quote(data)
env = dict()
env['wsgi.input'] = StringIO(urldata)
env['CONTENT_LENGTH'] = str(len(urldata))
env['CONTENT_TYPE'] = 'multipart/form-data; boundary=--boundary'
env['REQUEST_URI'] = '/query/' + request + '/'
env['REQUEST_METHOD'] = 'POST'
print(query.query_handler(env, output))
where query.query_handler is the module which is callable for uWSGI, i get
following in the log (as expected):
2011-04-06 16:32:29,157 DEBUG [austlog setup L:151] - Logger initialized
2011-04-06 16:32:29,460 ERROR [errors handle L:80] - An error of type
error_query_execution has occurred, state: ['ListPersonsByLastnameLike',
{'lastname': 'кин'}], stack: [('wsgi_wrapper_query.py', 30, '<module>', 'print
(query.query_handler(env, output))'), ('/var/www/devenv/pkolla/query.py', 10,
'query_handler', 'return lib.web.web_entry(handler, "query", environ,
start_response)'), ('/var/www/devenv/pkolla/lib/web.py', 82, 'web_entry',
'return str.encode(web_handler(handler, runtime_environ, signature, data))'),
('/var/www/devenv/pkolla/lib/web.py', 57, 'web_handler', 'dto = handler.process
(params)'), ('/var/www/devenv/pkolla/queries/queryhandler.py', 35, 'process',
'dto = errors.get_dto(self.context.error_handler, "error_query_execution",
[name, parameters])'), ('/var/www/devenv/pkolla/errors.py', 11, 'get_dto',
'client_error = error_handler.handle(error_type, state_object)')], trace:[('/
var/www/devenv/pkolla/queries/queryhandler.py', 32, 'process', 'result =
self.query.execute()'), ('/var/www/devenv/pkolla/queries/
ListPersonsByLastnameLike.py', 28, 'execute', 'raise ValueError'), <class
'ValueError'>, ValueError()]
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi