Python oslo_log.log.register_options() Examples
The following are 30
code examples of oslo_log.log.register_options().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
oslo_log.log
, or try the search function
.
Example #1
Source File: config.py From masakari with Apache License 2.0 | 6 votes |
def parse_args(argv, default_config_files=None, configure_db=True, init_rpc=True): log.register_options(CONF) # We use the oslo.log default log levels which includes suds=INFO # and add only the extra levels that Masakari needs log.set_defaults(default_log_levels=log.get_default_log_levels()) rpc.set_defaults(control_exchange='masakari') config.set_middleware_defaults() CONF(argv[1:], project='masakari', version=version.version_string(), default_config_files=default_config_files) if init_rpc: rpc.init(CONF) if configure_db: sqlalchemy_api.configure(CONF)
Example #2
Source File: share.py From manila with Apache License 2.0 | 6 votes |
def main(): log.register_options(CONF) gmr_opts.set_defaults(CONF) CONF(sys.argv[1:], project='manila', version=version.version_string()) log.setup(CONF, "manila") utils.monkey_patch() gmr.TextGuruMeditation.setup_autorun(version, conf=CONF) launcher = service.process_launcher() if CONF.enabled_share_backends: for backend in CONF.enabled_share_backends: host = "%s@%s" % (CONF.host, backend) server = service.Service.create(host=host, service_name=backend, binary='manila-share', coordination=True) launcher.launch_service(server) else: server = service.Service.create(binary='manila-share') launcher.launch_service(server) launcher.wait()
Example #3
Source File: config.py From freezer-api with Apache License 2.0 | 6 votes |
def parse_args(args=[]): CONF.register_cli_opts(api_common_opts()) register_db_drivers_opt() # register paste configuration paste_grp = cfg.OptGroup('paste_deploy', 'Paste Configuration') CONF.register_group(paste_grp) CONF.register_opts(paste_deploy, group=paste_grp) log.register_options(CONF) policy.Enforcer(CONF) default_config_files = cfg.find_config_files('freezer', 'freezer-api') CONF(args=args, project='freezer-api', default_config_files=default_config_files, version=FREEZER_API_VERSION )
Example #4
Source File: manage.py From freezer-api with Apache License 2.0 | 6 votes |
def parse_config(): DB_INIT = [ cfg.SubCommandOpt('db', dest='db', title='DB Options', handler=add_db_opts ) ] # register database backend drivers config.register_db_drivers_opt() # register database cli options CONF.register_cli_opts(DB_INIT) # register logging opts log.register_options(CONF) default_config_files = cfg.find_config_files('freezer', 'freezer-api') CONF(args=sys.argv[1:], project='freezer-api', default_config_files=default_config_files, version=FREEZER_API_VERSION )
Example #5
Source File: wsgi.py From designate with Apache License 2.0 | 6 votes |
def init_application(): conf_files = _get_config_files() logging.register_options(cfg.CONF) cfg.CONF([], project='designate', default_config_files=conf_files) config.set_defaults() logging.setup(cfg.CONF, 'designate') policy.init() if not rpc.initialized(): rpc.init(CONF) heartbeat = heartbeat_emitter.get_heartbeat_emitter('api') heartbeat.start() conf = conf_files[0] return deploy.loadapp('config:%s' % conf, name='osapi_dns')
Example #6
Source File: masakari_config.py From masakari with Apache License 2.0 | 6 votes |
def _log_setup(self): CONF = cfg.CONF self.set_request_context() DOMAIN = "masakari" CONF.log_file = self.conf_log.get("log_file") CONF.use_stderr = False logging.register_options(CONF) logging.setup(CONF, DOMAIN) log_dir = os.path.dirname(self.conf_log.get("log_file")) # create log dir if not created try: os.makedirs(log_dir) except OSError as exc: if exc.errno == errno.EEXIST and os.path.isdir(log_dir): pass else: raise return
Example #7
Source File: barbican_manage.py From barbican with Apache License 2.0 | 5 votes |
def main(): """Parse options and call the appropriate class/method.""" CONF = config.new_config() CONF.register_cli_opt(category_opt) try: logging.register_options(CONF) logging.setup(CONF, "barbican-manage") cfg_files = cfg.find_config_files(project='barbican') CONF(args=sys.argv[1:], project='barbican', prog='barbican-manage', version=barbican.version.__version__, default_config_files=cfg_files) except RuntimeError as e: sys.exit("ERROR: %s" % e) # find sub-command and its arguments fn = CONF.category.action_fn fn_args = [arg.decode('utf-8') for arg in CONF.category.action_args] fn_kwargs = {} for k in CONF.category.action_kwargs: v = getattr(CONF.category, 'action_kwarg_' + k) if v is None: continue if isinstance(v, bytes): v = v.decode('utf-8') fn_kwargs[k] = v # call the action with the remaining arguments try: return fn(*fn_args, **fn_kwargs) except Exception as e: sys.exit("ERROR: %s" % e)
Example #8
Source File: test_event.py From senlin with Apache License 2.0 | 5 votes |
def setUp(self): super(TestEvent, self).setUp() logging.register_options(cfg.CONF)
Example #9
Source File: config.py From barbican with Apache License 2.0 | 5 votes |
def new_config(): conf = cfg.ConfigOpts() log.register_options(conf) conf.register_opts(context_opts) conf.register_opts(common_opts) conf.register_opts(host_opts) conf.register_opts(db_opts) conf.register_opts(_options.eventlet_backdoor_opts) conf.register_opts(_options.periodic_opts) conf.register_opts(_options.ssl_opts, "ssl") conf.register_group(retry_opt_group) conf.register_opts(retry_opts, group=retry_opt_group) conf.register_group(queue_opt_group) conf.register_opts(queue_opts, group=queue_opt_group) conf.register_group(ks_queue_opt_group) conf.register_opts(ks_queue_opts, group=ks_queue_opt_group) conf.register_group(quota_opt_group) conf.register_opts(quota_opts, group=quota_opt_group) # Update default values from libraries that carry their own oslo.config # initialization and configuration. set_middleware_defaults() return conf
Example #10
Source File: base.py From os-vif with Apache License 2.0 | 5 votes |
def setUp(self): super(BaseFunctionalTestCase, self).setUp() logging.register_options(CONF) setup_logging(self.COMPONENT_NAME) fileutils.ensure_tree(DEFAULT_LOG_DIR, mode=0o755) log_file = sanitize_log_path( os.path.join(DEFAULT_LOG_DIR, "%s.txt" % self.id())) self.flags(log_file=log_file) privsep_helper = os.path.join( os.getenv('VIRTUAL_ENV', os.path.dirname(sys.executable)[:-4]), 'bin', 'privsep-helper') self.flags( helper_command=' '.join(['sudo', '-E', privsep_helper]), group=self.PRIVILEGED_GROUP)
Example #11
Source File: bifrost_inventory.py From bifrost with Apache License 2.0 | 5 votes |
def _parse_config(): config = cfg.ConfigOpts() log.register_options(config) config.register_cli_opts(opts) config(prog='bifrost_inventory.py') log.set_defaults() log.setup(config, "bifrost_inventory.py") return config
Example #12
Source File: inventory.py From bifrost with Apache License 2.0 | 5 votes |
def _parse_config(): config = cfg.ConfigOpts() log.register_options(config) config.register_cli_opts(opts) config(prog='bifrost_inventory.py') log.set_defaults() log.setup(config, "bifrost_inventory.py") return config
Example #13
Source File: service.py From watcher with Apache License 2.0 | 5 votes |
def prepare_service(argv=(), conf=cfg.CONF): log.register_options(conf) gmr_opts.set_defaults(conf) config.parse_args(argv) cfg.set_defaults(_options.log_opts, default_log_levels=_DEFAULT_LOG_LEVELS) log.setup(conf, 'python-watcher') conf.log_opt_values(LOG, log.DEBUG) objects.register_all() gmr.TextGuruMeditation.register_section( _('Plugins'), plugins_conf.show_plugins) gmr.TextGuruMeditation.setup_autorun(version, conf=conf)
Example #14
Source File: service.py From cloudkitty with Apache License 2.0 | 5 votes |
def prepare_service(argv=None, config_files=None): oslo_i18n.enable_lazy() log.register_options(cfg.CONF) log.set_defaults() defaults.set_cors_middleware_defaults() if argv is None: argv = sys.argv cfg.CONF(argv[1:], project='cloudkitty', validate_default_values=True, version=version.version_info.version_string(), default_config_files=config_files) log.setup(cfg.CONF, 'cloudkitty') messaging.setup()
Example #15
Source File: config.py From vitrage with Apache License 2.0 | 5 votes |
def parse_config(args, default_config_files=None): set_defaults() log.register_options(CONF) policy_opts.set_defaults(CONF) osprofiler_opts.set_defaults(CONF) db_options.set_defaults(CONF) for group, options in opts.list_opts(): CONF.register_opts(list(options), group=None if group == 'DEFAULT' else group) CONF(args[1:], project='vitrage', validate_default_values=True, default_config_files=default_config_files) if CONF.profiler.enabled: osprofiler_initializer.init_from_conf( conf=CONF, context=None, project='vitrage', service='api', host=CONF.api.host ) for datasource in CONF.datasources.types: opts.register_opts(datasource, CONF.datasources.path) keystone_client.register_keystoneauth_opts() log.setup(CONF, 'vitrage') CONF.log_opt_values(LOG, log.DEBUG) messaging.setup()
Example #16
Source File: barbican_manage.py From sgx-kms with Apache License 2.0 | 5 votes |
def main(): """Parse options and call the appropriate class/method.""" CONF = config.new_config() CONF.register_cli_opt(category_opt) try: logging.register_options(CONF) logging.setup(CONF, "barbican-manage") cfg_files = cfg.find_config_files(project='barbican') CONF(args=sys.argv[1:], project='barbican', prog='barbican-manage', version=barbican.version.__version__, default_config_files=cfg_files) except RuntimeError as e: sys.exit("ERROR: %s" % e) # find sub-command and its arguments fn = CONF.category.action_fn fn_args = [arg.decode('utf-8') for arg in CONF.category.action_args] fn_kwargs = {} for k in CONF.category.action_kwargs: v = getattr(CONF.category, 'action_kwarg_' + k) if v is None: continue if isinstance(v, six.string_types): v = v.decode('utf-8') fn_kwargs[k] = v # call the action with the remaining arguments try: ret = fn(*fn_args, **fn_kwargs) return(ret) except Exception as e: sys.exit("ERROR: %s" % e)
Example #17
Source File: config.py From sgx-kms with Apache License 2.0 | 5 votes |
def new_config(): conf = cfg.ConfigOpts() log.register_options(conf) conf.register_opts(context_opts) conf.register_opts(common_opts) conf.register_opts(host_opts) conf.register_opts(db_opts) conf.register_opts(_options.eventlet_backdoor_opts) conf.register_opts(_options.periodic_opts) conf.register_opts(_options.ssl_opts, "ssl") conf.register_group(retry_opt_group) conf.register_opts(retry_opts, group=retry_opt_group) conf.register_group(queue_opt_group) conf.register_opts(queue_opts, group=queue_opt_group) conf.register_group(ks_queue_opt_group) conf.register_opts(ks_queue_opts, group=ks_queue_opt_group) conf.register_group(quota_opt_group) conf.register_opts(quota_opts, group=quota_opt_group) # Update default values from libraries that carry their own oslo.config # initialization and configuration. set_middleware_defaults() return conf
Example #18
Source File: config.py From monasca-api with Apache License 2.0 | 5 votes |
def parse_args(argv=None): """Loads application configuration. Loads entire application configuration just once. """ global _CONF_LOADED if _CONF_LOADED: LOG.debug('Configuration has been already loaded') return log.set_defaults() log.register_options(CONF) argv = (argv if argv is not None else sys.argv[1:]) args = ([] if _is_running_under_gunicorn() else argv or []) CONF(args=args, prog=sys.argv[1:], project='monasca', version=version.version_str, default_config_files=get_config_files(), description='RESTful API for alarming in the cloud') log.setup(CONF, product_name='monasca-api', version=version.version_str) conf.register_opts() policy_opts.set_defaults(CONF) _CONF_LOADED = True
Example #19
Source File: test_fault.py From senlin with Apache License 2.0 | 5 votes |
def setUp(self): super(FaultMiddlewareTest, self).setUp() log.register_options(cfg.CONF)
Example #20
Source File: test_log.py From oslo.log with Apache License 2.0 | 5 votes |
def setUp(self): super(IsDebugEnabledTestCase, self).setUp() self.config_fixture = self.useFixture( fixture_config.Config(cfg.ConfigOpts())) self.config = self.config_fixture.config self.CONF = self.config_fixture.conf log.register_options(self.config_fixture.conf)
Example #21
Source File: config.py From senlin with Apache License 2.0 | 5 votes |
def parse_args(argv, name, default_config_files=None): log.register_options(CONF) if profiler: profiler.set_defaults(CONF) set_config_defaults() CONF( argv[1:], project='senlin', prog=name, version=version.version_info.version_string(), default_config_files=default_config_files, )
Example #22
Source File: config.py From monasca-notification with Apache License 2.0 | 5 votes |
def parse_args(argv): """Sets up configuration of monasca-notification.""" global _CONF_LOADED if _CONF_LOADED: LOG.debug('Configuration has been already loaded') return conf.register_opts(CONF) log.register_options(CONF) default_log_levels = (log.get_default_log_levels()) log.set_defaults(default_log_levels=default_log_levels) CONF(args=argv, project='monasca', prog=sys.argv[1:], version=version.version_string, default_config_files=_get_config_files(), description=''' monasca-notification is an engine responsible for transforming alarm transitions into proper notifications ''') conf.register_enabled_plugin_opts(CONF) log.setup(CONF, product_name='monasca-notification', version=version.version_string) _CONF_LOADED = True
Example #23
Source File: config.py From monasca-log-api with Apache License 2.0 | 5 votes |
def parse_args(argv=None): global _CONF_LOADED if _CONF_LOADED: LOG.debug('Configuration has been already loaded') return log.set_defaults() log.register_options(CONF) argv = (argv if argv is not None else sys.argv[1:]) args = ([] if _is_running_under_gunicorn() else argv or []) CONF(args=args, prog=sys.argv[1:], project='monasca', version=version.version_str, default_config_files=get_config_files(), description='RESTful API to collect log files') log.setup(CONF, product_name='monasca-log-api', version=version.version_str) conf.register_opts() policy_opts.set_defaults(CONF) _CONF_LOADED = True
Example #24
Source File: service.py From cyborg with Apache License 2.0 | 5 votes |
def prepare_service(argv=None): log.register_options(CONF) log.set_defaults(default_log_levels=CONF.default_log_levels) argv = argv or [] config.parse_args(argv) log.setup(CONF, 'cyborg') objects.register_all()
Example #25
Source File: service_utils.py From ironic-inspector with Apache License 2.0 | 5 votes |
def prepare_service(args=None): args = [] if args is None else args log.register_options(CONF) opts.set_config_defaults() opts.parse_args(args) rpc.init() log.setup(CONF, 'ironic_inspector') LOG.debug("Configuration:") CONF.log_opt_values(LOG, log.DEBUG)
Example #26
Source File: base.py From ironic-inspector with Apache License 2.0 | 5 votes |
def init_test_conf(self): CONF.reset() log.register_options(CONF) self.cfg = self.useFixture(config_fixture.Config(CONF)) self.cfg.set_default('connection', "sqlite:///", group='database') self.cfg.set_default('slave_connection', None, group='database') self.cfg.set_default('max_retries', 10, group='database') conf_opts.parse_args([], default_config_files=[]) self.policy = self.useFixture(policy_fixture.PolicyFixture())
Example #27
Source File: dbsync.py From ironic-inspector with Apache License 2.0 | 5 votes |
def main(args=sys.argv[1:]): log.register_options(CONF) CONF.register_cli_opt(command_opt) CONF(args, project='ironic-inspector') config = _get_alembic_config() config.set_main_option('script_location', "ironic_inspector:migrations") config.ironic_inspector_config = CONF CONF.command.func(config, CONF.command.name)
Example #28
Source File: migration.py From ironic-inspector with Apache License 2.0 | 5 votes |
def _setup_logger(args=None): args = [] if args is None else args log.register_options(CONF) opts.set_config_defaults() opts.parse_args(args) log.setup(CONF, 'ironic_inspector')
Example #29
Source File: service.py From aodh with Apache License 2.0 | 5 votes |
def prepare_service(argv=None, config_files=None): conf = cfg.ConfigOpts() oslo_i18n.enable_lazy() log.register_options(conf) log_levels = ( conf.default_log_levels + [ 'futurist=INFO', 'keystoneclient=INFO', 'oslo_db.sqlalchemy=WARN', 'cotyledon=INFO' ] ) log.set_defaults(default_log_levels=log_levels) defaults.set_cors_middleware_defaults() db_options.set_defaults(conf) if profiler_opts: profiler_opts.set_defaults(conf) policy_opts.set_defaults(conf, policy_file=os.path.abspath( os.path.join(os.path.dirname(__file__), "api", "policy.json"))) from aodh import opts # Register our own Aodh options for group, options in opts.list_opts(): conf.register_opts(list(options), group=None if group == "DEFAULT" else group) keystone_client.register_keystoneauth_opts(conf) conf(argv, project='aodh', validate_default_values=True, default_config_files=config_files) ka_loading.load_auth_from_conf_options(conf, "service_credentials") log.setup(conf, 'aodh') profiler.setup(conf) messaging.setup() return conf
Example #30
Source File: config.py From qinling with Apache License 2.0 | 5 votes |
def parse_args(args=None, usage=None, default_config_files=None): CLI_OPTS = [launch_opt] CONF.register_cli_opts(CLI_OPTS) for group, options in list_opts(): CONF.register_opts(list(options), group) _DEFAULT_LOG_LEVELS = [ 'eventlet.wsgi.server=WARN', 'oslo_service.periodic_task=INFO', 'oslo_service.loopingcall=INFO', 'oslo_db=WARN', 'oslo_concurrency.lockutils=WARN', 'kubernetes.client.rest=%s' % CONF.kubernetes.log_devel, 'keystoneclient=INFO', 'requests.packages.urllib3.connectionpool=CRITICAL', 'urllib3.connectionpool=CRITICAL', 'cotyledon=INFO', 'futurist.periodics=WARN' ] default_log_levels = log.get_default_log_levels() default_log_levels.extend(_DEFAULT_LOG_LEVELS) log.set_defaults(default_log_levels=default_log_levels) log.register_options(CONF) CONF( args=args, project='qinling', version=version, usage=usage, default_config_files=default_config_files )