Files
config/controllerconfig/controllerconfig/controllerconfig/common/oslolog.py
Carmen Rata 2e6666d3b3 Fix logging in controllerconfig package
Fix oslo logging implementation done in refactoring
from commit https://review.opendev.org/#/c/703516/6

Story: 2007403
Task: 39958

Change-Id: Ia5fe79a401da7efe24d2bc60c4afe827fd61fbd0
Signed-off-by: Carmen Rata <carmen.rata@windriver.com>
2020-06-30 18:12:43 -04:00

33 lines
702 B
Python

#
# Copyright (c) 2020 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
"""
Oslo Logging configuration
"""
from oslo_config import cfg
from oslo_log import log as logging
from controllerconfig.common import constants
def setup_logger():
""" Setup a logger """
# set in cfg what the valid syslog options are
logging.register_options(cfg.CONF)
# Send logs to /var/log/platform.log by overriding defaults
# to use syslog to local1
cfg.CONF.set_override("use_syslog", True)
cfg.CONF.set_override("syslog_log_facility", constants.LOG_LOCAL1)
logging.setup(cfg.CONF, 'controllerconfig')
def configure():
""" Setup logging """
setup_logger()