【问题标题】:How do I get server stacktrace for paster/waitress application on client side如何在客户端获取牧师/女服务员应用程序的服务器堆栈跟踪
【发布时间】:2014-05-11 14:29:39
【问题描述】:

我正在运行一个 python 金字塔应用程序并对其进行安静的调用。这是一个 wsgi 应用程序,使用 waitress 作为 http 服务器。目前,当我发出失败的 http 请求时,我会收到如下消息:

Internal Server Error
The server encountered an unexpected internal server error

如何配置 waitress 或 paste 本身以获取显示堆栈跟踪的错误,如下所示:

Traceback (most recent call last):
  File "/.../pyramid/eggs/waitress-0.8.8-py2.7.egg/waitress/channel.py", line 337, in service
    task.service()
  File "/.../pyramid/eggs/waitress-0.8.8-py2.7.egg/waitress/task.py", line 173, in service
    self.execute()
  ...
  File "/.../pyramid/eggs/pyramid-1.4.5-py2.7.egg/pyramid/config/views.py", line 469, in _class_requestonly_view
    response = getattr(inst, attr)()
  File "/.../pyramid/dustin/views.py", line 139, in delete
    raise Exception('DELETE op failed; oid %s not found' % deleteItem)
Exception: DELETE op failed; oid 00x not found

我的贴图配置是:

[app:main]
use = egg:myegg

pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = es

couchdb.uri = http://couchdb-host:5984/
couchdb.db = myegg

[server:main]
use = egg:waitress#main
host = 0.0.0.0
port = 6543

# Begin logging configuration

[loggers]
keys = root

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[handler_console]
class = StreamHandler
args = [sys.stdout]
level = DEBUG
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

# End logging configuration

【问题讨论】:

    标签: python logging pyramid paster waitress


    【解决方案1】:

    您能否使用Exception View 来捕获任何异常,并在响应中返回堆栈跟踪?我使用了类似的东西来捕获我所有的 Pyramid 异常,记录它们,然后向用户显示一个“友好的”错误页面渲染器。

    【讨论】:

    • 谢谢彼得。我想知道是否有办法告诉中间件传递堆栈跟踪。快速检查告诉我,目前是女服务员“吃掉”了异常。跨度>
    猜你喜欢
    • 2011-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-07
    • 2017-05-28
    • 2022-01-25
    相关资源
    最近更新 更多