Better logging of exceptions
Add workaround for Collectd which limits log size to 1023B. Add stack trace to exception handling for better logs/debugging. Closes-Bug #1570397 Change-Id: Ie9f1911e0fb367d5ce3637afd0909ab42a5efc61
This commit is contained in:
parent
eed7db17d3
commit
19fb15f51a
|
@ -42,7 +42,10 @@ class CollectdLogHandler(logging.Handler):
|
|||
|
||||
if self.cfg.VERBOSE and logging.DEBUG == record.levelno:
|
||||
logger = collectd.info
|
||||
logger(msg)
|
||||
|
||||
# collectd limits log size to 1023B, this is workaround
|
||||
for i in range(0, len(msg), 1023):
|
||||
logger(msg[i:i + 1023])
|
||||
|
||||
except Exception as e:
|
||||
collectd.info("Exception in logger %s" % e)
|
||||
|
|
|
@ -63,7 +63,7 @@ class Plugin(object):
|
|||
self._writer.write(vl, data)
|
||||
except Exception as exc:
|
||||
if collectd is not None:
|
||||
collectd.error('Exception during write: %s' % exc)
|
||||
LOGGER.exception('Exception during write: %s', exc)
|
||||
|
||||
def shutdown(self):
|
||||
"""Shutdown callback"""
|
||||
|
@ -73,7 +73,7 @@ class Plugin(object):
|
|||
self._writer.flush()
|
||||
except Exception as exc:
|
||||
if collectd is not None:
|
||||
collectd.error('Exception during shutdown: %s' % exc)
|
||||
LOGGER.exception('Exception during shutdown: %s', exc)
|
||||
|
||||
|
||||
# The collectd plugin instance
|
||||
|
|
|
@ -50,6 +50,9 @@ cat << EOF | sudo tee $COLLECTD_CONF_DIR/collectd-ceilometer-plugin.conf
|
|||
|
||||
<Module collectd_ceilometer_plugin>
|
||||
|
||||
# Verbosity 1|0
|
||||
#VERBOSE 0
|
||||
|
||||
# Batch size
|
||||
BATCH_SIZE 3
|
||||
|
||||
|
|
Loading…
Reference in New Issue