Log configuration values on API startup
It's very helpful for every service to log its configuration values on startup, so you can e.g. check typos. Also, change the print statements in the API binary to info logs. Change-Id: I1b4181ddc7f36149cddb2c24f514d526c403b2e0
This commit is contained in:
parent
63f68735c2
commit
22b6a39d5d
@ -18,6 +18,7 @@
|
||||
# under the License.
|
||||
"""Set up the development API server.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
from wsgiref import simple_server
|
||||
@ -28,6 +29,7 @@ from ceilometer.openstack.common import gettextutils
|
||||
gettextutils.install('ceilometer')
|
||||
|
||||
from ceilometer.api import app
|
||||
from ceilometer.openstack.common import log
|
||||
from ceilometer import service
|
||||
|
||||
|
||||
@ -43,13 +45,16 @@ if __name__ == '__main__':
|
||||
host, port = '0.0.0.0', int(cfg.CONF.metering_api_port)
|
||||
srv = simple_server.make_server(host, port, root)
|
||||
|
||||
print 'Starting server in PID %s' % os.getpid()
|
||||
LOG = log.getLogger(__name__)
|
||||
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':
|
||||
print 'serving on 0.0.0.0:%s, view at http://127.0.0.1:%s' % \
|
||||
(port, port)
|
||||
LOG.info('serving on 0.0.0.0:%s, view at http://127.0.0.1:%s' %
|
||||
(port, port))
|
||||
else:
|
||||
print "serving on http://%s:%s" % (host, port)
|
||||
LOG.info("serving on http://%s:%s" % (host, port))
|
||||
|
||||
try:
|
||||
srv.serve_forever()
|
||||
|
Loading…
Reference in New Issue
Block a user