Add option values log for cloudkitty-api

Currently, when launch the cloudkitty-api service, the configure option
values will don't be record in log file, unlike others projects in
openstack. This patch add the options value logging and the info of api
server stating.

Change-Id: I63957e23dbbd109d62fa50c8d0797b1d56649259
This commit is contained in:
liu-sheng 2015-04-22 12:14:41 +08:00
parent 96edf2a95c
commit 0766b0869b
1 changed files with 13 additions and 2 deletions

View File

@ -15,6 +15,7 @@
#
# @author: Stéphane Albert
#
import logging
import os
from wsgiref import simple_server
@ -25,12 +26,12 @@ import pecan
from cloudkitty.api import config as api_config
from cloudkitty.api import hooks
from cloudkitty.api import middleware
from cloudkitty.openstack.common import log as logging
from cloudkitty.openstack.common import log
from cloudkitty import rpc
from cloudkitty import storage
LOG = logging.getLogger(__name__)
LOG = log.getLogger(__name__)
auth_opts = [
cfg.StrOpt('api_paste_config',
@ -99,6 +100,16 @@ def build_server():
# Create the WSGI server and start it
host = CONF.api.host_ip
port = CONF.api.port
LOG.info('Starting server in PID %s' % os.getpid())
LOG.info("Configuration:")
cfg.CONF.log_opt_values(LOG, logging.INFO)
if host == '0.0.0.0':
LOG.info('serving on 0.0.0.0:%(sport)s, view at http://127.0.0.1:%'
'(vport)s' % {'sport': port, 'vport': port})
else:
LOG.info("serving on http://%(host)s:%(port)s" %
{'host': host, 'port': port})
server_cls = simple_server.WSGIServer
handler_cls = simple_server.WSGIRequestHandler