> -----Original Message----- > From: Andrew Milton [mailto:a...@theinternet.com.au] > Sent: Wednesday, August 05, 2009 3:49 PM > To: Ken Winter > Cc: 'Zope List' > Subject: Re: [Zope] Getting Zope code to output to event.log > > +-------[ Ken Winter ]---------------------- > | To debug my code in my Zope/Plone site, I sometimes need to put logger > lines > | into Zope/Plone code, in order to trace my way through an error > traceback. > | > | > | > | I can do this easily with Plone code in the Plone Products folder: Just > put in > | the logger line, restart Zope, run my tests, and the output appears in > the Zope > | event.log. But when I try the same thing with native Zope code (for > example, > | in the OFS directory), the output doesn?t show up in event.log. > | > | > | > | I figure these modules have to be reinstalled or re-somethinged to get > my > | changes activated, but I don?t know how to do this. Can you help? > > [this assumes the code is actually being called] > > You are probably logging at a level below the level that will be output > into the log. > > LOG.info() is about the lowest level that will go out by default. > > Without seeing any examples from you it's hard to tell.
Here's an example of the traceback from the error I'm trying to debug. I assume the fact that a module appears in the traceback proves that it is being called. 2009-08-05T15:11:20 ERROR Zope.SiteErrorLog http://instance3.dhat.webfactional.com/groups/Popper Traceback (innermost last): Module ZPublisher.Publish, line 115, in publish Module ZPublisher.mapply, line 88, in mapply Module ZPublisher.Publish, line 41, in call_object Module Shared.DC.Scripts.Bindings, line 311, in __call__ Module Shared.DC.Scripts.Bindings, line 348, in _bindAndExec Module Products.PythonScripts.PythonScript, line 326, in _exec Module None, line 19, in Popper - <PythonScript at /groups/Popper> - Line 19 Module Products.Groups.standard_tree, line 131, in populateStandardTrees Module Products.Groups.standard_tree, line 189, in populateStandardTree Module Products.CMFCore.PortalFolder, line 414, in invokeFactory Module Products.CMFCore.TypesTool, line 937, in constructContent Module Products.CMFCore.TypesTool, line 345, in constructInstance Module Products.CMFCore.TypesTool, line 359, in _finishConstruction Module Products.CMFCore.CMFCatalogAware, line 145, in notifyWorkflowCreated Module Products.CMFCore.WorkflowTool, line 409, in notifyCreated Module Products.CMFCore.WorkflowTool, line 760, in _reindexWorkflowVariables Module Products.Archetypes.CatalogMultiplex, line 108, in reindexObjectSecurity Module Products.ZCatalog.CatalogBrains, line 52, in _unrestrictedGetObject Module OFS.Traversable, line 187, in unrestrictedTraverse - __traceback_info__: (['event', 'base-events'], 'practical-matters') Module Products.Five.traversable, line 143, in __bobo_traverse__ AttributeError: practical-matters Here's a snippet from the unrestrictedTraverse() method of instance3/Zope-2.9.8-final/lib/python/OFS/Traversable.py: ... try: obj = self while path: name = path_pop() logger.info("unrestrictedTraverse(): " "\n\t path = %r\n\t name = %r" % (path, name)) __traceback_info__ = path, name if name[0] == '_': # Never allowed in a URL. raise NotFound, name if name == '..': next = aq_parent(obj) if next is not _none: if restricted and not securityManager.validate( obj, obj,name, next): raise Unauthorized, name obj = next continue bobo_traverse = _getattr(obj, '__bobo_traverse__', _none) logger.info("unrestrictedTraverse(): before bobo_traverse") if bobo_traverse is not _none: ... The only thing I've changed in this snippet is to add the two logger lines. I also had to add these lines at the top of the Traversable.py module: import logging logger = logging.getLogger('OFS/Traversable.py:') ~ HTH ~ Ken _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )