Remove error.log and access.log creation and render logging.conf from templates.

This commit is contained in:
Corey Bryant 2014-12-16 20:18:51 +00:00
parent 9a203f3846
commit 95145cf906
2 changed files with 41 additions and 11 deletions

View File

@ -901,15 +901,8 @@ def git_pre_install():
'/etc/keystone',
]
# TODO(coreycb): Revisit this. 'keystone-manage db_sync' fails without
# the error/access logs having been created. might have been a permission
# denied so perhaps chmod is enough?
logs = [
'/var/log/keystone/keystone.log',
'/home/ubuntu/error.log',
'/home/ubuntu/access.log',
os.path.join(charm_dir(), 'error.log'),
os.path.join(charm_dir(), 'access.log'),
]
adduser('keystone', shell='/bin/bash', system_user=True)
@ -939,15 +932,13 @@ def git_post_install():
'src': os.path.join(src_etc, 'keystone-paste.ini'),
'dest': '/etc/keystone/keystone-paste.ini',
},
'logging': {
'src': os.path.join(src_etc, 'logging.conf.sample'),
'dest': '/etc/keystone/logging.conf',
},
}
for conf, files in configs.iteritems():
shutil.copyfile(files['src'], files['dest'])
render('logging.conf', '/etc/keystone/logging.conf', {}, perms=0o644)
keystone_context = {
'service_description': 'Keystone API server',
'service_name': 'Keystone',

39
templates/logging.conf Normal file
View File

@ -0,0 +1,39 @@
[loggers]
keys=root
[formatters]
keys=normal,normal_with_name,debug
[handlers]
keys=production,file,devel
[logger_root]
level=WARNING
handlers=file
[handler_production]
class=handlers.SysLogHandler
level=ERROR
formatter=normal_with_name
args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
[handler_file]
class=FileHandler
level=DEBUG
formatter=normal_with_name
args=('/var/log/keystone/keystone.log', 'a')
[handler_devel]
class=StreamHandler
level=NOTSET
formatter=debug
args=(sys.stdout,)
[formatter_normal]
format=%(asctime)s %(levelname)s %(message)s
[formatter_normal_with_name]
format=(%(name)s): %(asctime)s %(levelname)s %(message)s
[formatter_debug]
format=(%(name)s): %(asctime)s %(levelname)s %(module)s %(funcName)s %(message)s