summaryrefslogtreecommitdiffstats
path: root/Lib/logging/__init__.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-02-07 12:56:54 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-02-07 12:56:54 (GMT)
commit64e8b970f9e7364ae62bd726cea6d6d7c60ecb34 (patch)
treede83136f18a2df497c30f43304cf7ae027545296 /Lib/logging/__init__.py
parentb86d3fa43c0cb29c7c018c6a1e926163d7ebacf4 (diff)
downloadcpython-64e8b970f9e7364ae62bd726cea6d6d7c60ecb34.zip
cpython-64e8b970f9e7364ae62bd726cea6d6d7c60ecb34.tar.gz
cpython-64e8b970f9e7364ae62bd726cea6d6d7c60ecb34.tar.bz2
Issue #7869: logging: improved format-time diagnostics and removed some 1.5.2 support code.
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r--Lib/logging/__init__.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 5c727b0..b5c48d3 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -769,7 +769,10 @@ class Handler(Filterer):
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 @@ def shutdown(handlerList=_handlerList):
#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