Fix unicode error when logging.

Change-Id: I2400bc4e63934f118a4b1b32326585269677c085
This commit is contained in:
Deklan Dieterly 2014-09-30 16:14:53 -06:00
parent 8032e47a3f
commit a58acce9b4

View File

@ -123,7 +123,7 @@ class AlarmPersister(threading.Thread):
self.conf.influxdb.database_name)
for message in consumer:
LOG.debug(message.message)
LOG.debug(message.message.value.decode('utf8'))
decoded = json.loads(message.message.value)
LOG.debug(json.dumps(decoded, sort_keys=True, indent=4))
@ -202,7 +202,7 @@ class MetricPersister(threading.Thread):
self.conf.influxdb.database_name)
for message in consumer:
LOG.debug(message.message.value)
LOG.debug(message.message.value.decode('utf8'))
decoded = json.loads(message.message.value)
LOG.debug(json.dumps(decoded, sort_keys=True, indent=4))
@ -224,7 +224,7 @@ class MetricPersister(threading.Thread):
for dimension_name in decoded['metric']['dimensions']:
dimensions[dimension_name] = (
decoded['metric']['dimensions'][dimension_name])
LOG.debug('dimension %s : %s', dimension_name,
LOG.debug('dimension: %s : %s', dimension_name,
dimensions[dimension_name])
time_stamp = decoded['metric']['timestamp']