error reporting unification

It is easy to make the assumption that any error that shows up in the error reporting utility in the ZMI is also copied to the SiteError? log (typically STDOUT in a standard Zope 3 configuration), and vice versa. This assumption is true in Zope 2, where in the error_log object you can actually request the error to be logged to the shell as well.

It however does not appear to be the case in the error handling logic in Zope 3. Instead, all errors appear to be logged to the error reporting utility, but only errors that:

  • have views
  • have this view provide the ISystemErrorView? interface
  • and have a method on this view isSystemError() returning True

appear to get logged to the SiteError? log (and thus STDOUT).

In certain circumstances this leads to errors that do not appear on STDOUT that do get logged into the error reporting utility. This is rather surprising. It also makes it impossible for the error reporting utility to set policy on which errors get reported, at least for the SiteError? log. It isn't currently setting such policy, but it might do so in the future.

What's the motivation for the differences? We propose to unify the error reporting utility with the SiteError? code, so that the utility is always responsible for logging to the SiteError? log as well.

The logic to be refactored is in zope.app.publication.ZopePublication?, in the method handleException.

See also the following collector issue: this I made before I decided it would probably need to be a proposal:

http://www.zope.org/Collectors/Zope3-dev/695


comments:

+1 --philikon, 2006/08/24 10:00 EST reply
I agree with this proposal. I think the IErrorReportingUtility? should be responsible for logging errors, including dispatching them to the logging machinery (which is what SiteError above refers to).

Requiring the ISystemErrorView? makes sense in a way because you wouldn't want to log UserErrors?. Perhaps the restrictions don't work out too well currently, but there should be some sort of machinery to prevent overzealous logging of UserError?, NotFound?, Unauthorized, etc. (of course, it's always nice to be able to log them).

Since the logging responsibility will be put in the hands of IErrorReportUtilities?, it would make sense to also provide a global implementation of that (currently there are only persistent ones), so that the lookup won't fail when no site has been traversed yet.



( 97 subscribers )