2014-05-11 27 views
1

我正在運行一個python金字塔應用程序並對其進行平穩調用。這是一個wsgi應用程序,並使用女服務員作爲http服務器。目前,當我提出一個失敗的HTTP請求,我得到這樣的消息:如何在客戶端獲取paster/waitress應用程序的服務器棧跟蹤

Internal Server Error 
The server encountered an unexpected internal server error 

我將如何配置女服務員或貼紙本身出現錯誤,顯示堆棧跟蹤,就像這樣:

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 

回答

0

你可以使用一個Exception View來捕獲任何異常,並在響應返回堆棧跟蹤?我使用類似的東西來捕捉我所有的Pyramid異常,記錄它們,然後向用戶顯示一個「友好的」錯誤頁面渲染器。

+0

感謝彼得..我想知道是否有辦法告訴中間件通過棧跟蹤..快速檢查告訴我,這是一個服務員,「吃」目前的例外。 – RoyM

相關問題