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
  • Loading branch information
markmc committed May 28, 2013
1 parent 2fcd263 commit e6a083f
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')
if cfg.CONF.enable_v1_api:
from ceilometer.api.v1 import app as v1app
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 @@ -95,37 +95,13 @@ def _make_app(self, enable_acl=False):
root_dir = self.path_get()

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': 'DEBUG', 'handlers': ['console']},
'wsme': {'level': 'DEBUG', '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 e6a083f

Please sign in to comment.