Only add logging handlers if there currently aren't any

This corrects an odd problem where Horizon would stand up multiple
client objects, which would cause duplicate/triplicate/dozens of
repeated log lines in its log files, due to multiple identical
handlers being added to the logging object

Fixes Bug 1182678

Change-Id: I198f3ecbb687bff69a06a166574b998cce54f2ac
This commit is contained in:
Nicolas Simonds 2013-05-21 16:19:38 -07:00
parent 8044dc7478
commit 2a446c5b6b

@ -82,7 +82,7 @@ class HTTPClient(object):
self.verify_cert = True
self._logger = logging.getLogger(__name__)
if self.http_log_debug:
if self.http_log_debug and not self._logger.handlers:
ch = logging.StreamHandler()
self._logger.setLevel(logging.DEBUG)
self._logger.addHandler(ch)