- Plone 3 Products Development Cookbook
- Juan Pablo Gimenez Marcos F.Romero
- 299字
- 2021-08-06 17:05:59
Debugging Zope exceptions with PDBDebug Mode
Whenever an exception is fired by some situation not foreseen during development, we can trace the exception in Zope logs or in the console itself. Many times during development, it's more useful to get direct access to the exception's context to better understand the problem. PDBDebugMode, a postmortem debugger, allows us to do that. It opens a pdb
prompt to let us get our hands dirty.
How to do it…
- Add a
Products.PDBDebugMode
line in theeggs
parameter of the[buildout]
part.[buildout] ... # Add additional eggs here eggs = iw.debug Products.DocFinderTab Products.Clouseau Products.PDBDebugMode
- Rebuild the Zope instance:
./bin/buildout
- Test
PDBDebugMode
. As we said earlier, from now on every time Zope fires an exception (if running in debug mode), apdb
(not anipdb
though) will prompt us to inspect the context.- For an easy test, we must first tell Zope to pay attention to (that is, not ignore) the kind of exceptions we are going to produce. Open your browser and go to
http://localhost:8080/plone/prefs_error_log_form
and delete theNotFound
line in Ignored exception types field (or you can also follow theipzope
example we included in Accessing an IPython powered shell earlier). - Then type any URL that you know doesn't exist, like
http://localhost:8080/plone/doesnt-exist
.
Now check your console. You will see a
pdb
prompt waiting for you. Unluckily, this example is not a very good one because the exception was fired by theZPublisher
(try writingself
in the console), so we can't see familiar code. - For an easy test, we must first tell Zope to pay attention to (that is, not ignore) the kind of exceptions we are going to produce. Open your browser and go to
Note
You can suffer problems with PDBDebugMode
such as triggering on at unexpected times, causing apparent slowness, or freezes. Thus, if your instance doesn't seem to be responding, check its console.
More information about PDBDebugMode
is available at: http://plone.org/products/pdbdebugmode.
See also
- Accessing an IPython powered shell
- Vue.js前端開(kāi)發(fā)技術(shù)
- IBM Rational ClearCase 7.0: Master the Tools That Monitor, Analyze, and Manage Software Configurations
- 設(shè)計(jì)模式之禪(第2版)
- AutoCAD快速自學(xué)寶典(2018中文版)
- Adobe 創(chuàng)意大學(xué)動(dòng)漫設(shè)計(jì)師Flash CS5 + Photoshop CS5 標(biāo)準(zhǔn)實(shí)訓(xùn)教材
- Procreate+ SketchUp +Photoshop建筑設(shè)計(jì)手繪表現(xiàn)技法
- Salesforce CRM: The Definitive Admin Handbook
- 剪映:從零開(kāi)始精通短視頻剪輯(電腦版)
- Cassandra High Performance Cookbook
- Deep Inside osCommerce: The Cookbook
- Mobile Web Development
- Joomla! 1.5 JavaScript jQuery
- 剪映:零基礎(chǔ)輕松掌握手機(jī)剪輯短視頻
- 計(jì)算機(jī)圖形制作CorelDRAW X6項(xiàng)目教程
- Adobe創(chuàng)意大學(xué)視頻編輯師 After Effects CS5 + Premiere Pro CS5 標(biāo)準(zhǔn)實(shí)訓(xùn)教材