[Grok-dev] logging of errors

Jan-Wijbrand Kolman janwijbrand at gmail.com
Wed Jan 26 04:11:41 EST 2011


Hi,

Grok 1.3 includes the recent zope.app.appsetup 3.15.0 version that will 
bootstrap the error reporting utility in a fresh ZODB with a 'copy to 
zlog' flag set to True. This was considered as the fix for not having 
log output at all.

However, as a result of both this copy_to_zlog setting *and* the 
introduction of zope.errorview, we now have duplicate error logging.

Let me try to explain, hopefully this will lead to a solution:

The copy_to_zlog setting used to be set to False ever since back in the 
days. The reason we didn't see *any* errors logged in the logs files in 
recent versions of Grok, is, I think, due to misconfigured error views.

Whenever the publisher encounters an exception while publishing an 
object, it will hand over the handling of the exception to the zope 
publication object - the handleException() call. Part of the important 
housekeeping done there, is logging the error with the error reporting 
utility. Since the copy_to_zlog setting used to be False, we would not 
see log output from this.

Later in the handleException() call a view is looked up for the 
exception that is being handled. Whenever the view that was found, 
provided ISystemErrorView, the handleException() call will *itself* log 
the error!

In case there was no error view found however (which was probably the 
case in recent grok versions except for the latest), the 
handleException() would not log anything itself. This, in combination 
with the copy_to_zlog setting set to False, results in a empty log file.

So, by both fixing the error views *and* setting the copy_to_zlog 
setting to True, we now have duplicate logging *sigh*.

What to do:

1) Ignore it: duplicate logging is better than no logging. This is yuck 
of course.

2) Setting the copy_to_zlog back to False. I personally think however, 
that the logging of the error should not solely depend in the 
implementation of the registered error views.

thus,

3) Have the views in zope.errorview *not* provide ISystemErrorView, so 
that the publication object will not log the error *itself* too.

4) Discuss the issue on zope-dev. The multiple logging attempts in the 
zope publication object could perhaps be simplified/consolidated.

By writing all this down, my current preference is option 3). But maybe 
you guys have other ideas?

regards, jw








More information about the Grok-dev mailing list