diff --git a/zaqar/bootstrap.py b/zaqar/bootstrap.py index 89d812e88..fd31d8970 100644 --- a/zaqar/bootstrap.py +++ b/zaqar/bootstrap.py @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from oslo_config import cfg from oslo_log import log from stevedore import driver @@ -33,19 +32,6 @@ from zaqar.i18n import _LE LOG = log.getLogger(__name__) -_CLI_OPTIONS = ( - configs._ADMIN_MODE_OPT, - cfg.BoolOpt('daemon', default=False, - help='Run Zaqar server in the background.'), -) - -# NOTE (Obulpathi): Register daemon command line option for -# zaqar-server -CONF = cfg.CONF -CONF.register_cli_opts(_CLI_OPTIONS) -log.register_options(CONF) - - class Bootstrap(object): """Defines the Zaqar bootstrapper. @@ -61,8 +47,6 @@ class Bootstrap(object): self.driver_conf = self.conf[configs._DRIVER_GROUP] - log.setup(conf, 'zaqar') - @decorators.lazy_property(write=False) def api(self): LOG.debug(u'Loading API handler') diff --git a/zaqar/cmd/server.py b/zaqar/cmd/server.py index ff5812a66..b9c7b3114 100644 --- a/zaqar/cmd/server.py +++ b/zaqar/cmd/server.py @@ -15,9 +15,18 @@ import os from oslo_config import cfg +from oslo_log import log from zaqar import bootstrap from zaqar.common import cli +from zaqar.common import configs + +# NOTE(eggmaster): define command line options for zaqar-server +_CLI_OPTIONS = ( + configs._ADMIN_MODE_OPT, + cfg.BoolOpt('daemon', default=False, + help='Run Zaqar server in the background.'), +) @cli.runnable @@ -26,13 +35,18 @@ def run(): # to pick up common options from openstack.common.log, since # that module uses the global CONF instance exclusively. conf = cfg.CONF + conf(project='zaqar', prog='zaqar-server') + # NOTE(eggmaster): register command line options for zaqar-server + conf.register_cli_opts(_CLI_OPTIONS) + log.register_options(conf) + log.setup(conf, 'zaqar') + # NOTE(jeffrey4l): Overwrite the default vaule for # logging_context_format_string. Add project_id into it. conf.set_default('logging_context_format_string', '%(asctime)s.%(msecs)03d %(process)d %(levelname)s' ' %(name)s [%(request_id)s %(user_identity)s]' ' [project_id:%(project_id)s] %(message)s') - conf(project='zaqar', prog='zaqar-queues') server = bootstrap.Bootstrap(conf)