Granular logging control

Following commits matches the logging behaviour
that can be found in monasca-log-api and will be available
in monasca-api.
With it, it is possible to granullary control severities
of different components of monasca-persister.
Provides logging to the console and file.
File logging has rotating capability enabled.

Change-Id: If16138b38a5a4344c18eefe159d80585a8c68819
This commit is contained in:
Tomasz Trębski 2016-10-08 20:40:38 +00:00
parent af08d6a1b4
commit f1555c1868
2 changed files with 51 additions and 7 deletions

View File

@ -0,0 +1,50 @@
[loggers]
keys = root, kafka, influxdb, cassandra
[handlers]
keys = console, file
[formatters]
keys = generic
[logger_root]
level = DEBUG
formatter = default
handlers = console, file
[logger_kafka]
qualname = kafka
level = DEBUG
formatter = default
handlers = console, file
propagate = 0
[logger_influxdb]
qualname = influxdb
level = DEBUG
formatter = default
handlers = console, file
propagate = 0
[logger_cassandra]
qualname = cassandra
level = DEBUG
formatter = default
handlers = console, file
propagate = 0
[handler_console]
class = logging.StreamHandler
args = (sys.stderr,)
level = DEBUG
formatter = generic
[handler_file]
class = logging.handlers.RotatingFileHandler
level = DEBUG
formatter = generic
# store up to 5*100MB of logs
args = ('/var/log/monasca/persister/persister.log', 'a', 104857600, 5)
[formatter_generic]
format = %(asctime)s %(levelname)s [%(name)s][%(threadName)s] %(message)s

View File

@ -1,11 +1,5 @@
[DEFAULT] [DEFAULT]
log_file = persister.log log_config_append=/etc/monasca/persister-logging.conf
log_dir = /var/log/monasca/persister
# Default log level is WARNING
# Show debugging output in logs (sets DEBUG log level output)
debug = false
# Show more verbose log output (sets INFO log level output) if debug is False
verbose = true
[repositories] [repositories]
# The driver to use for the metrics repository # The driver to use for the metrics repository