diff options
author | Matthew Edmonds <edmondsw@us.ibm.com> | 2017-08-18 09:59:19 -0400 |
---|---|---|
committer | Matthew Edmonds <edmondsw@us.ibm.com> | 2018-03-20 13:29:15 +0000 |
commit | 12fb92ce8759e247761feae77fa8a656b1de5cdf (patch) | |
tree | 695c9fb6e82a62460113bda5782915ccc689d667 /heat | |
parent | fed80b7c9e2b07c327afbb5c60c1bb8c98176cce (diff) | |
download | heat-12fb92ce8759e247761feae77fa8a656b1de5cdf.tar.gz |
fix logger names
Most files are using getLogger(__name__) so that logging statements
are associated with the file they came from, but there are several
places where this practice has not been followed. This changes to
use __name__ consistently for most code. Per review comments,
commands and wsgi apps are instead updated to use the command/app
name.
Change-Id: Ic2594b88dd818df5486800e4759848d43edc24d1
Diffstat (limited to 'heat')
-rw-r--r-- | heat/cmd/all.py | 2 | ||||
-rw-r--r-- | heat/cmd/api.py | 20 | ||||
-rw-r--r-- | heat/cmd/api_cfn.py | 22 | ||||
-rw-r--r-- | heat/cmd/engine.py | 20 | ||||
-rw-r--r-- | heat/engine/clients/os/keystone/heat_keystoneclient.py | 2 | ||||
-rw-r--r-- | heat/httpd/heat_api.py | 18 | ||||
-rw-r--r-- | heat/httpd/heat_api_cfn.py | 22 |
7 files changed, 57 insertions, 49 deletions
diff --git a/heat/cmd/all.py b/heat/cmd/all.py index 423ef853b..8cda6d81b 100644 --- a/heat/cmd/all.py +++ b/heat/cmd/all.py @@ -36,8 +36,6 @@ from oslo_service import systemd i18n.enable_lazy() -LOG = logging.getLogger('heat.all') - API_LAUNCH_OPTS = {'setup_logging': False} LAUNCH_SERVICES = { diff --git a/heat/cmd/api.py b/heat/cmd/api.py index e074094a8..c6dcabdde 100644 --- a/heat/cmd/api.py +++ b/heat/cmd/api.py @@ -35,30 +35,32 @@ from heat.common import profiler from heat.common import wsgi from heat import version + i18n.enable_lazy() -LOG = logging.getLogger('heat.api') +CONF = cfg.CONF def launch_api(setup_logging=True): if setup_logging: - logging.register_options(cfg.CONF) - cfg.CONF(project='heat', prog='heat-api', - version=version.version_info.version_string()) + logging.register_options(CONF) + CONF(project='heat', prog='heat-api', + version=version.version_info.version_string()) if setup_logging: - logging.setup(cfg.CONF, 'heat-api') + logging.setup(CONF, CONF.prog) + LOG = logging.getLogger(CONF.prog) config.set_config_defaults() messaging.setup() app = config.load_paste_app() - port = cfg.CONF.heat_api.bind_port - host = cfg.CONF.heat_api.bind_host + port = CONF.heat_api.bind_port + host = CONF.heat_api.bind_host LOG.info('Starting Heat REST API on %(host)s:%(port)s', {'host': host, 'port': port}) - profiler.setup('heat-api', host) + profiler.setup(CONF.prog, host) gmr.TextGuruMeditation.setup_autorun(version) - server = wsgi.Server('heat-api', cfg.CONF.heat_api) + server = wsgi.Server(CONF.prog, CONF.heat_api) server.start(app, default_port=port) return server diff --git a/heat/cmd/api_cfn.py b/heat/cmd/api_cfn.py index cc258656d..8821ac0fd 100644 --- a/heat/cmd/api_cfn.py +++ b/heat/cmd/api_cfn.py @@ -37,32 +37,34 @@ from heat.common import profiler from heat.common import wsgi from heat import version + i18n.enable_lazy() -LOG = logging.getLogger('heat.api.cfn') +CONF = cfg.CONF def launch_cfn_api(setup_logging=True): if setup_logging: - logging.register_options(cfg.CONF) - cfg.CONF(project='heat', - prog='heat-api-cfn', - version=version.version_info.version_string()) + logging.register_options(CONF) + CONF(project='heat', + prog='heat-api-cfn', + version=version.version_info.version_string()) if setup_logging: - logging.setup(cfg.CONF, 'heat-api-cfn') + logging.setup(CONF, CONF.prog) logging.set_defaults() + LOG = logging.getLogger(CONF.prog) config.set_config_defaults() messaging.setup() app = config.load_paste_app() - port = cfg.CONF.heat_api_cfn.bind_port - host = cfg.CONF.heat_api_cfn.bind_host + port = CONF.heat_api_cfn.bind_port + host = CONF.heat_api_cfn.bind_host LOG.info('Starting Heat API on %(host)s:%(port)s', {'host': host, 'port': port}) - profiler.setup('heat-api-cfn', host) + profiler.setup(CONF.prog, host) gmr.TextGuruMeditation.setup_autorun(version) - server = wsgi.Server('heat-api-cfn', cfg.CONF.heat_api_cfn) + server = wsgi.Server(CONF.prog, CONF.heat_api_cfn) server.start(app, default_port=port) return server diff --git a/heat/cmd/engine.py b/heat/cmd/engine.py index 81860fcf9..1341f92c5 100644 --- a/heat/cmd/engine.py +++ b/heat/cmd/engine.py @@ -38,19 +38,21 @@ from heat.engine import template from heat.rpc import api as rpc_api from heat import version + i18n.enable_lazy() -LOG = logging.getLogger('heat.engine') +CONF = cfg.CONF def launch_engine(setup_logging=True): if setup_logging: - logging.register_options(cfg.CONF) - cfg.CONF(project='heat', prog='heat-engine', - version=version.version_info.version_string()) + logging.register_options(CONF) + CONF(project='heat', prog='heat-engine', + version=version.version_info.version_string()) if setup_logging: - logging.setup(cfg.CONF, 'heat-engine') + logging.setup(CONF, CONF.prog) logging.set_defaults() + LOG = logging.getLogger(CONF.prog) messaging.setup() config.startup_sanity_check() @@ -65,14 +67,14 @@ def launch_engine(setup_logging=True): from heat.engine import service as engine # noqa - profiler.setup('heat-engine', cfg.CONF.host) + profiler.setup(CONF.prog, CONF.host) gmr.TextGuruMeditation.setup_autorun(version) - srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC) - workers = cfg.CONF.num_engine_workers + srv = engine.EngineService(CONF.host, rpc_api.ENGINE_TOPIC) + workers = CONF.num_engine_workers if not workers: workers = max(4, processutils.get_worker_count()) - launcher = service.launch(cfg.CONF, srv, workers=workers, + launcher = service.launch(CONF, srv, workers=workers, restart_method='mutate') return launcher diff --git a/heat/engine/clients/os/keystone/heat_keystoneclient.py b/heat/engine/clients/os/keystone/heat_keystoneclient.py index 21131d30b..0b0b7cf4c 100644 --- a/heat/engine/clients/os/keystone/heat_keystoneclient.py +++ b/heat/engine/clients/os/keystone/heat_keystoneclient.py @@ -30,7 +30,7 @@ from heat.common import context from heat.common import exception from heat.common.i18n import _ -LOG = logging.getLogger('heat.engine.clients.keystoneclient') +LOG = logging.getLogger(__name__) AccessKey = collections.namedtuple('AccessKey', ['id', 'access', 'secret']) diff --git a/heat/httpd/heat_api.py b/heat/httpd/heat_api.py index 1b0395d6d..284e9809e 100644 --- a/heat/httpd/heat_api.py +++ b/heat/httpd/heat_api.py @@ -28,21 +28,23 @@ from heat.common import profiler from heat import version as hversion +CONF = cfg.CONF + + def init_application(): i18n.enable_lazy() - LOG = logging.getLogger('heat.api') - - logging.register_options(cfg.CONF) + logging.register_options(CONF) version = hversion.version_info.version_string() - cfg.CONF(project='heat', prog='heat-api', version=version) - logging.setup(cfg.CONF, 'heat-api') + CONF(project='heat', prog='heat-api', version=version) + logging.setup(CONF, CONF.prog) + LOG = logging.getLogger(CONF.prog) config.set_config_defaults() messaging.setup() - port = cfg.CONF.heat_api.bind_port - host = cfg.CONF.heat_api.bind_host - profiler.setup('heat-api', host) + port = CONF.heat_api.bind_port + host = CONF.heat_api.bind_host + profiler.setup(CONF.prog, host) LOG.info('Starting Heat REST API on %(host)s:%(port)s', {'host': host, 'port': port}) return config.load_paste_app() diff --git a/heat/httpd/heat_api_cfn.py b/heat/httpd/heat_api_cfn.py index e86a92ef4..cdd9b7993 100644 --- a/heat/httpd/heat_api_cfn.py +++ b/heat/httpd/heat_api_cfn.py @@ -28,24 +28,26 @@ from heat.common import profiler from heat import version +CONF = cfg.CONF + + def init_application(): i18n.enable_lazy() - LOG = logging.getLogger('heat.api.cfn') - - logging.register_options(cfg.CONF) - cfg.CONF(project='heat', - prog='heat-api-cfn', - version=version.version_info.version_string()) - logging.setup(cfg.CONF, 'heat-api-cfn') + logging.register_options(CONF) + CONF(project='heat', + prog='heat-api-cfn', + version=version.version_info.version_string()) + logging.setup(CONF, CONF.prog) logging.set_defaults() + LOG = logging.getLogger(CONF.prog) config.set_config_defaults() messaging.setup() - port = cfg.CONF.heat_api_cfn.bind_port - host = cfg.CONF.heat_api_cfn.bind_host + port = CONF.heat_api_cfn.bind_port + host = CONF.heat_api_cfn.bind_host LOG.info('Starting Heat API on %(host)s:%(port)s', {'host': host, 'port': port}) - profiler.setup('heat-api-cfn', host) + profiler.setup(CONF.prog, host) return config.load_paste_app() |