Skip to content

Commit

Permalink
Don't use pecan to configure logging
Browse files Browse the repository at this point in the history
Fixes bug #1184941

openstack.common.log gives a mechanism to configure logging and, by
default, we will set up a handler on root logger. Using pecan to also
configure a handler on the 'ironic' logger means every log message gets
logged to console twice.

It seems that the pecan logging configuration stuff is redundant with
our existing logging configuration infrastructure.

Change-Id: Iec0630b0e842e3b6a90021bf552d9b857c5a0552
(cherry picked from commit e6a083f)
  • Loading branch information
markmc authored and Eoghan Glynn committed May 31, 2013
1 parent cd9a30e commit ff94b0e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 48 deletions.
4 changes: 1 addition & 3 deletions ceilometer/api/app.py
Expand Up @@ -61,8 +61,7 @@ def setup_app(pecan_config=None, extra_hooks=None):
pecan_config.app.root,
static_root=pecan_config.app.static_root,
template_path=pecan_config.app.template_path,
logging=getattr(pecan_config, 'logging', {}),
debug=getattr(pecan_config.app, 'debug', False),
debug=CONF.debug,
force_canonical=getattr(pecan_config.app, 'force_canonical', True),
hooks=app_hooks,
wrap_app=middleware.ParsableErrorMiddleware,
Expand All @@ -77,7 +76,6 @@ def setup_app(pecan_config=None, extra_hooks=None):
class VersionSelectorApplication(object):
def __init__(self):
pc = get_pecan_config()
pc.app.debug = CONF.debug
pc.app.enable_acl = (CONF.auth_strategy == 'keystone')
self.v1 = v1app.make_app(cfg.CONF, enable_acl=pc.app.enable_acl)
self.v2 = setup_app(pecan_config=pc)
Expand Down
21 changes: 0 additions & 21 deletions ceilometer/api/config.py
Expand Up @@ -14,27 +14,6 @@
'enable_acl': True,
}

logging = {
'loggers': {
'root': {'level': 'INFO', 'handlers': ['console']},
'ceilometer': {'level': 'DEBUG', 'handlers': ['console']},
'wsme': {'level': 'DEBUG', 'handlers': ['console']}
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
}
},
'formatters': {
'simple': {
'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]'
'[%(threadName)s] %(message)s')
}
},
}

# Custom Configurations must be in Python dictionary format::
#
# foo = {'bar':'baz'}
Expand Down
24 changes: 0 additions & 24 deletions ceilometer/tests/api.py
Expand Up @@ -93,37 +93,13 @@ def _make_app(self, enable_acl=False):
)

self.config = {

'app': {
'root': 'ceilometer.api.controllers.root.RootController',
'modules': ['ceilometer.api'],
'static_root': '%s/public' % root_dir,
'template_path': '%s/ceilometer/api/templates' % root_dir,
'enable_acl': enable_acl,
},

'logging': {
'loggers': {
'root': {'level': 'INFO', 'handlers': ['console']},
'wsme': {'level': 'INFO', 'handlers': ['console']},
'ceilometer': {'level': 'DEBUG',
'handlers': ['console'],
},
},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'simple'
}
},
'formatters': {
'simple': {
'format': ('%(asctime)s %(levelname)-5.5s [%(name)s]'
'[%(threadName)s] %(message)s')
}
},
},
}

return pecan.testing.load_test_app(self.config)
Expand Down

0 comments on commit ff94b0e

Please sign in to comment.