]> granicus.if.org Git - python/commitdiff
Fixes #12637: Last resort messages now correctly handled. Thanks to Xavier de Gaye...
authorVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 25 Jul 2011 18:53:28 +0000 (19:53 +0100)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>
Mon, 25 Jul 2011 18:53:28 +0000 (19:53 +0100)
Lib/logging/__init__.py

index e4b34a1af73fa6b0742f8f67468b398c951c956f..0af8bb7dca76ecd3c345beec5f408923cb7ff744 100644 (file)
@@ -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 @@ class Logger(Filterer):
                 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)