> Zope 2.7 is using the logging package internally as the implementation > for its old zLOG API. We've run into one problem, probably caused by > carelessness on our part. > > zLOG allows you to pass exc_info to be logged, but logging only allows > you to specify a flag saying whether the current exception should be > logged. (I recall that this was discussed at length, but not why the > current solution was reached.) There are several call sites that depend > on this feature to capture an exception, try to recover gracefully or > log a traceback if recovery is impossible. So we depend on this > feature, but can't get it out of logging very easily. > > We've come up with this as a work-around: ["Gross" workaround snipped] I propose to make the following change: def _log(self, level, msg, args, exc_info=None): # ... if exc_info: if type(exc_info) != types.TupleType: exc_info = sys.exc_info() record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info) self.handle(record) This should allow passing an exception tuple in the exc_info parameter - in which case, that's used instead of calling sys.exc_info(). It is a slight change to the semantics but I can't think of any (non-pathological) code which will break. Can anyone see any problems with this approach? Regards, Vinay
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4