Fix plugin logging

Fix logging of debug, info and warning levels.
Also configuration parameter VERBOSE is working again.

fixes problems:
* VERBOSE parameter can be changed at runtime
* Initial log level was unset, then there was nothing logged lower than
exception level. (for example configuration dump was not logged)
* Initial VERBOSE was set to True, then it was too much verbose. And
this flag was mean to be used for debugging problems.

NOTE: real log level is driven by collectd configuration, not by plugin
config.

Change-Id: Ia7048ccb74f27a5d5885b9c0bda17d6fba603e9b
Closes-Bug: #1664973
This commit is contained in:
Jaroslav Safka
2017-02-16 09:23:54 +00:00
committed by Emma Foley
parent 0aa39651ee
commit f903de3f10
12 changed files with 45 additions and 37 deletions

View File

@@ -39,10 +39,9 @@ def register_plugin(collectd):
config = Config.instance()
# Setup loggging
log_handler = CollectdLogHandler(collectd=collectd)
log_handler.cfg = config
log_handler = CollectdLogHandler(collectd=collectd, config=config)
ROOT_LOGGER.addHandler(log_handler)
ROOT_LOGGER.setLevel(logging.NOTSET)
ROOT_LOGGER.setLevel(logging.DEBUG)
# Creates collectd plugin instance
instance = Plugin(collectd=collectd, config=config)