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: I020b3999c9008b996286ccb74a7801c96c43e71c
This commit is contained in:
Nicolas Simonds
2013-05-21 16:25:11 -07:00
parent 40db3fb6ad
commit de6f512051

View File

@@ -113,7 +113,7 @@ class HTTPClient(object):
# logging setup
self.debug_log = debug
if self.debug_log:
if self.debug_log and not _logger.handlers:
ch = logging.StreamHandler()
_logger.setLevel(logging.DEBUG)
_logger.addHandler(ch)