[Python-checkins] cpython (3.2): Fixes #12637: Last resort messages now correctly handled. Thanks to Xavier de

vinay.sajip python-checkins at python.org
Mon Jul 25 20:58:20 CEST 2011


http://hg.python.org/cpython/rev/d11a1a373f58
changeset:   71500:d11a1a373f58
branch:      3.2
parent:      71496:198627bbe242
user:        Vinay Sajip <vinay_sajip at yahoo.co.uk>
date:        Mon Jul 25 19:53:28 2011 +0100
summary:
  Fixes #12637: Last resort messages now correctly handled. Thanks to Xavier de Gaye for the patch."

files:
  Lib/logging/__init__.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -18,7 +18,7 @@
 Logging package for Python. Based on PEP 282 and comments thereto in
 comp.lang.python, and influenced by Apache's log4j system.
 
-Copyright (C) 2001-2010 Vinay Sajip. All Rights Reserved.
+Copyright (C) 2001-2011 Vinay Sajip. All Rights Reserved.
 
 To use, simply 'import logging' and log away!
 """
@@ -1440,7 +1440,8 @@
                 c = c.parent
         if (found == 0):
             if lastResort:
-                lastResort.handle(record)
+                if record.levelno >= lastResort.level:
+                    lastResort.handle(record)
             elif raiseExceptions and not self.manager.emittedNoHandlerWarning:
                 sys.stderr.write("No handlers could be found for logger"
                                  " \"%s\"\n" % self.name)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list