[Zope-Checkins] CVS: Packages/zLOG - EventLogger.py:1.8.6.4
Andreas Jung
lists at andreas-jung.com
Tue Aug 3 00:55:18 EDT 2004
Hey, that's Jim code. But it looks like the only solution to pass traceback
triple to the logging
module of Python without shipping a patched package or using monkey
patching. At least
there is a comment explaining the insantiy.
Being-insane-all-day
Andreas
--On Dienstag, 3. August 2004 0:42 Uhr -0400 Chris McDonough
<chrism at plope.com> wrote:
> This smells awfully funny:
>
> try:
>
> raise
>
> except:
>
> pass
>
> ... ok, I read the collector issue. That's insane. It's code like this
> that drives me nuts two years later, but I don't have a better
> suggestion. ;-)
>
> - C
>
> On Mon, 2004-08-02 at 07:48, Andreas Jung wrote:
>> Update of /cvs-repository/Packages/zLOG
>> In directory cvs.zope.org:/tmp/cvs-serv4004
>>
>> Modified Files:
>> Tag: Zope-2_7-branch
>> EventLogger.py
>> Log Message:
>> Collector #1234: an exception triple passed to LOG() was not propagated
>> properly to the logging module of Python
>>
>>
>> === Packages/zLOG/EventLogger.py 1.8.6.3 => 1.8.6.4 ===
>> --- Packages/zLOG/EventLogger.py:1.8.6.3 Fri Sep 19 17:16:49 2003
>> +++ Packages/zLOG/EventLogger.py Mon Aug 2 07:48:33 2004
>> @@ -52,6 +52,16 @@
>> if detail:
>> msg = "%s\n%s" % (msg, detail)
>>
>> + # Since the logging module of Python does not allow to pass a
>> + # traceback triple, we need to fake the exception. (See also
>> + # Collector #1234).
>> +
>> + if isinstance(error, tuple):
>> + try:
>> + raise error[0], error[1], error[2]
>> + except:
>> + pass
>> +
>> self.logger.log(level, msg, exc_info=(error is not None))
>>
>> event_logger = EventLogger()
>>
>> _______________________________________________
>> Zope-Checkins maillist - Zope-Checkins at zope.org
>> http://mail.zope.org/mailman/listinfo/zope-checkins
>>
More information about the Zope-Checkins
mailing list