summaryrefslogtreecommitdiffstats
path: root/Lib/logging/config.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-06-27 20:54:28 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-06-27 20:54:28 (GMT)
commita82addb5f335dbca8727f0598ee4855c23a5f708 (patch)
tree732cc96c51d6e075633c13ea0aec358d9d8ea48d /Lib/logging/config.py
parent28df4df079c8a5ca7173a170616548beead876c3 (diff)
downloadcpython-a82addb5f335dbca8727f0598ee4855c23a5f708.zip
cpython-a82addb5f335dbca8727f0598ee4855c23a5f708.tar.gz
cpython-a82addb5f335dbca8727f0598ee4855c23a5f708.tar.bz2
Merged revisions 80712,81651 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r80712 | vinay.sajip | 2010-05-03 10:11:53 -0500 (Mon, 03 May 2010) | 1 line Issue #8576: logging updated to remove usage of find_unused_port(). ........ r81651 | vinay.sajip | 2010-06-02 05:05:31 -0500 (Wed, 02 Jun 2010) | 1 line Logging: improved error reporting for BaseConfigurator.resolve(). ........
Diffstat (limited to 'Lib/logging/config.py')
-rw-r--r--Lib/logging/config.py26
1 files changed, 17 insertions, 9 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index 1e5ff68..63193b1 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -386,15 +386,21 @@ class BaseConfigurator(object):
"""
name = s.split('.')
used = name.pop(0)
- found = self.importer(used)
- for frag in name:
- used += '.' + frag
- try:
- found = getattr(found, frag)
- except AttributeError:
- self.importer(used)
- found = getattr(found, frag)
- return found
+ try:
+ found = self.importer(used)
+ for frag in name:
+ used += '.' + frag
+ try:
+ found = getattr(found, frag)
+ except AttributeError:
+ self.importer(used)
+ found = getattr(found, frag)
+ return found
+ except ImportError:
+ e, tb = sys.exc_info()[1:]
+ v = ValueError('Cannot resolve %r: %s' % (s, e))
+ v.__cause__, v.__traceback__ = e, tb
+ raise v
def ext_convert(self, value):
"""Default converter for the ext:// protocol."""
@@ -873,6 +879,8 @@ def listen(port=DEFAULT_LOGGING_CONFIG_PORT):
def run(self):
server = self.rcvr(port=self.port, handler=self.hdlr,
ready=self.ready)
+ if self.port == 0:
+ self.port = server.server_address[1]
self.ready.set()
global _listener
logging._acquireLock()