[Zope-Checkins] SVN: Zope/trunk/ Collector #1234: an exception triple passed to LOG() was not propagated properly to

Andreas Jung andreas at andreas-jung.com
Mon Aug 2 14:12:32 EDT 2004


Log message for revision 26864:
  Collector #1234: an exception triple passed to LOG() was not propagated properly to
  the logging module of Python
  


Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/zLOG/EventLogger.py


-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2004-08-02 15:21:16 UTC (rev 26863)
+++ Zope/trunk/doc/CHANGES.txt	2004-08-02 18:12:31 UTC (rev 26864)
@@ -139,6 +139,9 @@
 
     Bugs fixed
 
+     - Collector #1234: an exception triple passed to LOG() was not 
+       propagated properly to the logging module of Python
+
      - Collector #1441: Removed headers introduced to make Microsoft
        webfolders and office apps happy, since they make a lot of
        standards-compliant things unhappy AND they trick MS Office

Modified: Zope/trunk/lib/python/zLOG/EventLogger.py
===================================================================
--- Zope/trunk/lib/python/zLOG/EventLogger.py	2004-08-02 15:21:16 UTC (rev 26863)
+++ Zope/trunk/lib/python/zLOG/EventLogger.py	2004-08-02 18:12:31 UTC (rev 26864)
@@ -42,6 +42,18 @@
         msg = "%s\n%s" % (msg, detail)
 
     logger = logging.getLogger(subsystem)
+
+
+    # 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
+
     logger.log(level, msg, exc_info=(error is not None))
 
 



More information about the Zope-Checkins mailing list