我的问题是如何在日志/生产代码中获得合理的(Flask)堆栈跟踪?当生产中出现异常时,我所有的都是日志消息.
来自http GET的良好堆栈跟踪:
Traceback (most recent call last): file "/var/task/handler.py",line 96,in handler response = Response.from_app(app,environ) file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-v6XvIH/Werkzeug/werkzeug/wrappers.py",line 865,in from_app file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-v6XvIH/Werkzeug/werkzeug/wrappers.py",line 57,in _run_wsgi_app file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-v6XvIH/Werkzeug/werkzeug/test.py",line 871,in run_wsgi_app file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-v6XvIH/zappa/zappa/mIDdleware.py",line 78,in __call__ file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-v6XvIH/flask/flask/app.py",line 1836,line 1820,in wsgi_app file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-jvEYWI/flask-restful/flask_restful/__init__.py",line 271,in error_router file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-v6XvIH/flask/flask/app.py",line 1403,in handle_exception file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-jvEYWI/flask-restful/flask_restful/__init__.py",line 268,line 1817,in wsgi_app file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-v6XvIH/flask/flask/app.py",line 1477,in full_dispatch_request file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-jvEYWI/flask-restful/flask_restful/__init__.py",line 1381,in handle_user_exception file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-jvEYWI/flask-restful/flask_restful/__init__.py",line 1475,in full_dispatch_request file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-v6XvIH/flask/flask/app.py",line 1461,in dispatch_request file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-jvEYWI/flask-restful/flask_restful/__init__.py",line 477,in wrapper file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-v6XvIH/flask/flask/vIEws.py",line 84,in vIEw file "/private/var/folders/1j/5zcxjzkx29b8tfgrh2y90wt80000gn/T/pip-build-jvEYWI/flask-restful/flask_restful/__init__.py",line 587,in dispatch_request file "/Users/notacat/src/aws-lambda/zappa/controllers/error_controller.py",line 15,in getTestError: 'This is a test error'
难以理解ClouDWatch日志中的堆栈跟踪:
...Rlc3RFcnJvcjogJ1RoaXMgaXMgYSB0ZXN0IGVycm9yJzxiciAvPjwvcHJlPg==: Exception Traceback (most recent call last): file "/var/task/handler.py",line 161,in lambda_handler return LambdaHandler.lambda_handler(event,context) file "/var/task/handler.py",line 55,in lambda_handler return cls().handler(event,line 155,in handler raise Exception(exception) Exception: PCFET0NUWVBfigh0bWw+NTAwliBGcm9tIFphcHBhOiA8cHJlPIDUaGlzIGl...解决方法 这看起来像一个老问题,但我正在使用Zappa 0.45.1,当通过ClouDWatch AWS终端和使用提供ClouDWatch日志和一些附加信息的zappa tail发生错误时,我可以看到我的python堆栈跟踪. 总结
以上是内存溢出为你收集整理的如何在AWS Lambda上使用Python从Zappa获取堆栈跟踪全部内容,希望文章能够帮你解决如何在AWS Lambda上使用Python从Zappa获取堆栈跟踪所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)