[Python-checkins] r78081 - in python/trunk: Lib/logging/__init__.py Lib/logging/config.py Misc/NEWS

vinay.sajip python-checkins at python.org
Sun Feb 7 13:56:54 CET 2010


Author: vinay.sajip
Date: Sun Feb 7 13:56:54 2010
New Revision: 78081
Log:
Issue #7869: logging: improved format-time diagnostics and removed some 1.5.2 support code.
Modified:
 python/trunk/Lib/logging/__init__.py
 python/trunk/Lib/logging/config.py
 python/trunk/Misc/NEWS
Modified: python/trunk/Lib/logging/__init__.py
==============================================================================
--- python/trunk/Lib/logging/__init__.py	(original)
+++ python/trunk/Lib/logging/__init__.py	Sun Feb 7 13:56:54 2010
@@ -769,7 +769,10 @@
 if raiseExceptions:
 ei = sys.exc_info()
 try:
- traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)
+ traceback.print_exception(ei[0], ei[1], ei[2],
+ None, sys.stderr)
+ sys.stderr.write('Logged from file %s, line %s\n' % (
+ record.filename, record.lineno))
 except IOError:
 pass # see issue 5971
 finally:
@@ -1572,17 +1575,8 @@
 #else, swallow
 
 #Let's try and shutdown automatically on application exit...
-try:
- import atexit
- atexit.register(shutdown)
-except ImportError: # for Python versions < 2.0
- def exithook(status, old_exit=sys.exit):
- try:
- shutdown()
- finally:
- old_exit(status)
-
- sys.exit = exithook
+import atexit
+atexit.register(shutdown)
 
 # Null handler
 
Modified: python/trunk/Lib/logging/config.py
==============================================================================
--- python/trunk/Lib/logging/config.py	(original)
+++ python/trunk/Lib/logging/config.py	Sun Feb 7 13:56:54 2010
@@ -58,15 +58,11 @@
 the ability to select from various pre-canned configurations (if the
 developer provides a mechanism to present the choices and load the chosen
 configuration).
- In versions of ConfigParser which have the readfp method [typically
- shipped in 2.x versions of Python], you can pass in a file-like object
- rather than a filename, in which case the file-like object will be read
- using readfp.
 """
 import ConfigParser
 
 cp = ConfigParser.ConfigParser(defaults)
- if hasattr(cp, 'readfp') and hasattr(fname, 'readline'):
+ if hasattr(fname, 'readline'):
 cp.readfp(fname)
 else:
 cp.read(fname)
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Sun Feb 7 13:56:54 2010
@@ -75,6 +75,8 @@
 Library
 -------
 
+- Issue #7869: logging: improved diagnostic for format-time errors.
+
 - Issue #7868: logging: added loggerClass attribute to Manager.
 
 - Issue #7851: logging: clarification on logging configuration files.


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /