在 CherryPy 中将错误输出到浏览器
我是cherrypy的新手,似乎无法弄清楚如何让cherrypy在发生错误时向我的浏览器发出堆栈跟踪或错误消息。
我在 apache 上使用 mod_wsgi 运行cherrypy,因此在开发过程中挖掘 apache 错误日志特别烦人。
我习惯了 PHP,当脚本崩溃时,错误会很好地输出到浏览器。调试时这是一个有用的功能。在 CherryPy 中如何做到这一点?
关于 登录 CherryPy 的部分似乎没有涵盖这一点,除非我遗漏了一些明显的东西。
I am new to cherrypy, and can't seem to figure out how to have cherrypy emit a stacktrace or error message to my browser when an error occurs.
I am running cherrypy on apache with mod_wsgi, so its particularly annoying to dig through the apache error logs during development.
I am used to PHP, where errors are nicely output to the browser when your script crashes. It is a useful feature when debugging. How does one do this in CherryPy?
This section on logging in CherryPy doesn't seem to cover that, unless I'm missing something obvious.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
管理浏览器中回溯的最重要的配置设置是 <代码>request.show_tracebacks。将其设置为
True
以获取回溯。请注意,使用“生产”配置环境 将其设置为错误。您可能正在使用其他 WSGI 组件,或者 mod_wsgi 或 Apache 的某些功能也会造成妨碍,但我不能谈论这些。
The most important config setting which governs tracebacks in the browser is
request.show_tracebacks
. Set it toTrue
to get tracebacks. Note that using the "production" config environment sets this toFalse
. There may be other WSGI components you're using, or some feature of mod_wsgi or Apache which is also getting in the way, but I can't speak to those.