February 22 2008posted by Santi

Debugging Zope 2.9+

In Zope 2.9, the refresh feature doesn't work, so the best way to debug when developing is:

   1. Run your zope using bin/runzope, and use CTRL-C to restart every time you want to test your changes

   2. Use import pdb; pdb.set_trace() wherever you want in your code. This will break the zope execution in that point and you will be able to examine the situation carefully

   3.Configure your zope.conf to log debug messages:
      <eventlog>
      level DEBUG
      <logfile>
      path $INSTANCE/log/event.log
      level INFO
      </logfile>
      <logfile>
      path $INSTANCE/log/debug.log
      level DEBUG
      </logfile>
      </eventlog>

   4. Also notice that the use of zLOG is deprecated, and standard python logger should be used:
      from logging import getLogger
      logger = getLogger('YourProduct.YourModule')
      logger.debug(“your detailed message”)