当前位置: 首页>>代码示例>>Python>>正文


Python log.DEBUG属性代码示例

本文整理汇总了Python中oslo_log.log.DEBUG属性的典型用法代码示例。如果您正苦于以下问题:Python log.DEBUG属性的具体用法?Python log.DEBUG怎么用?Python log.DEBUG使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在oslo_log.log的用法示例。


在下文中一共展示了log.DEBUG属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def main():
    priv_context.init(root_helper=shlex.split(utils.get_root_helper()))
    zun_service.prepare_service(sys.argv)

    LOG.info('Starting server in PID %s', os.getpid())
    CONF.log_opt_values(LOG, logging.DEBUG)

    CONF.import_opt('topic', 'zun.conf.compute', group='compute')

    from zun.compute import manager as compute_manager
    endpoints = [
        compute_manager.Manager(),
    ]

    server = rpc_service.Service.create(CONF.compute.topic, CONF.host,
                                        endpoints, binary='zun-compute')
    launcher = service.launch(CONF, server, restart_method='mutate')
    launcher.wait() 
开发者ID:openstack,项目名称:zun,代码行数:20,代码来源:compute.py

示例2: setup_app

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def setup_app(pecan_config=None, debug=False, argv=None):
    """Creates and returns a pecan wsgi app."""
    if argv is None:
        argv = sys.argv
    octavia_service.prepare_service(argv)
    cfg.CONF.log_opt_values(LOG, logging.DEBUG)

    _init_drivers()

    if not pecan_config:
        pecan_config = get_pecan_config()
    pecan_configuration.set_config(dict(pecan_config), overwrite=True)

    return pecan_make_app(
        pecan_config.app.root,
        wrap_app=_wrap_app,
        debug=debug,
        hooks=pecan_config.app.hooks,
        wsme=pecan_config.wsme
    ) 
开发者ID:openstack,项目名称:octavia,代码行数:22,代码来源:app.py

示例3: retry

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def retry(exceptions, interval=1, retries=3, backoff_rate=2):

    if retries < 1:
        raise ValueError(_('Retries must be greater than or '
                         'equal to 1 (received: %s). ') % retries)

    def _decorator(f):

        @six.wraps(f)
        def _wrapper(*args, **kwargs):
            r = tenacity.Retrying(
                before_sleep=tenacity.before_sleep_log(LOG, logging.DEBUG),
                after=tenacity.after_log(LOG, logging.DEBUG),
                stop=tenacity.stop_after_attempt(retries),
                reraise=True,
                retry=tenacity.retry_if_exception_type(exceptions),
                wait=tenacity.wait_exponential(
                    multiplier=interval, min=0, exp_base=backoff_rate))
            return r.call(f, *args, **kwargs)

        return _wrapper

    return _decorator 
开发者ID:openstack,项目名称:os-brick,代码行数:25,代码来源:utils.py

示例4: test_pass_args_to_log

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def test_pass_args_to_log(self):
        a = SavingAdapter(self.mock_log, {})

        message = 'message'
        exc_message = 'exception'
        val = 'value'
        a.log(logging.DEBUG, message, name=val, exc_info=exc_message)

        expected = {
            'exc_info': exc_message,
            'extra': {'name': val, 'extra_keys': ['name']},
        }

        actual = a.results[0]
        self.assertEqual(message, actual[0])
        self.assertEqual(expected, actual[1])
        results = actual[2]
        self.assertEqual(message, results[0])
        self.assertEqual(expected, results[1]) 
开发者ID:openstack,项目名称:oslo.log,代码行数:21,代码来源:test_log.py

示例5: initialize_application

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def initialize_application():
    conf_files = _get_config_files()
    api_config.parse_args([], default_config_files=conf_files)
    logging.setup(CONF, "masakari")

    objects.register_all()
    CONF(sys.argv[1:], project='masakari', version=version.version_string())

    # NOTE: Dump conf at debug (log_options option comes from oslo.service)
    # This is gross but we don't have a public hook into oslo.service to
    # register these options, so we are doing it manually for now;
    # remove this when we have a hook method into oslo.service.
    CONF.register_opts(service_opts.service_opts)
    if CONF.log_options:
        CONF.log_opt_values(logging.getLogger(__name__), logging.DEBUG)

    config.set_middleware_defaults()
    rpc.init(CONF)
    conf = conf_files[0]

    return deploy.loadapp('config:%s' % conf, name="masakari_api") 
开发者ID:openstack,项目名称:masakari,代码行数:23,代码来源:api.py

示例6: setup_logging

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def setup_logging(self):
        # Assign default logs to self.LOG so we can still
        # assert on senlin logs.
        default_level = logging.INFO
        if os.environ.get('OS_DEBUG') in _TRUE_VALUES:
            default_level = logging.DEBUG

        self.LOG = self.useFixture(
            fixtures.FakeLogger(level=default_level, format=_LOG_FORMAT))
        base_list = set([nlog.split('.')[0] for nlog in
                         logging.getLogger().logger.manager.loggerDict])
        for base in base_list:
            if base in TEST_DEFAULT_LOGLEVELS:
                self.useFixture(fixtures.FakeLogger(
                    level=TEST_DEFAULT_LOGLEVELS[base],
                    name=base, format=_LOG_FORMAT))
            elif base != 'senlin':
                self.useFixture(fixtures.FakeLogger(
                    name=base, format=_LOG_FORMAT)) 
开发者ID:openstack,项目名称:senlin,代码行数:21,代码来源:base.py

示例7: init_application

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def init_application():
    # NOTE(hberaud): Call reset to ensure the ConfigOpts object doesn't
    # already contain registered options if the app is reloaded.
    CONF.reset()
    # Initialize the oslo configuration library and logging
    service.prepare_service(sys.argv)
    profiler.setup('zun-api', CONF.host)

    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, log.DEBUG)

    return app.load_app() 
开发者ID:openstack,项目名称:zun,代码行数:14,代码来源:wsgi.py

示例8: _debug_log_for_routes

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def _debug_log_for_routes(self, msg, routes, bgp_speaker_id):

        # Could have a large number of routes passed, check log level first
        if LOG.isEnabledFor(logging.DEBUG):
            for route in routes:
                LOG.debug(msg, route, bgp_speaker_id) 
开发者ID:openstack,项目名称:neutron-dynamic-routing,代码行数:8,代码来源:bgp_plugin.py

示例9: test_record_logs_dependencies

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def test_record_logs_dependencies(self):
        entry = db.create_pending_row(self.db_context, *self.UPDATE_ROW)

        logger = self.useFixture(fixtures.FakeLogger(level=logging.DEBUG))
        journal.record(self.db_context, *self.UPDATE_ROW)
        self.assertIn(str(entry.seqnum), logger.output) 
开发者ID:openstack,项目名称:networking-odl,代码行数:8,代码来源:test_journal.py

示例10: _sg_callback

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def _sg_callback(self, callback, resource, event, trigger, **kwargs):
        if 'payload' in kwargs:
            # TODO(boden): remove shim once all callbacks use payloads
            context = kwargs['payload'].context
            res = kwargs['payload'].desired_state
            res_id = kwargs['payload'].resource_id
            copy_kwargs = kwargs
        else:
            context = kwargs['context']
            res = kwargs.get(resource)
            res_id = kwargs.get("%s_id" % resource)
            copy_kwargs = kwargs.copy()
            copy_kwargs.pop('context')

        if res_id is None:
            res_id = res.get('id')
        odl_res_type = _RESOURCE_MAPPING[resource]

        odl_ops = _OPERATION_MAPPING[event]
        odl_res_dict = None if res is None else {odl_res_type.singular: res}

        _log_on_callback(logging.DEBUG, "Calling callback", odl_ops,
                         odl_res_type, res_id, odl_res_dict, copy_kwargs)
        try:
            callback(context, odl_ops, odl_res_type, res_id, odl_res_dict,
                     **copy_kwargs)
        except Exception as e:
            # In case of precommit, neutron registry notification caller
            # doesn't log its exception. In networking-odl case, we don't
            # normally throw exception. So log it here for debug
            with excutils.save_and_reraise_exception():
                if not db_api.is_retriable(e):
                    _log_on_callback(logging.ERROR, "Exception from callback",
                                     odl_ops, odl_res_type, res_id,
                                     odl_res_dict, copy_kwargs) 
开发者ID:openstack,项目名称:networking-odl,代码行数:37,代码来源:callback.py

示例11: main

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def main():
    magnum_service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    LOG.info('Starting server in PID %s', os.getpid())
    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, logging.DEBUG)

    conductor_id = short_id.generate_id()
    endpoints = [
        indirection_api.Handler(),
        cluster_conductor.Handler(),
        conductor_listener.Handler(),
        ca_conductor.Handler(),
        federation_conductor.Handler(),
        nodegroup_conductor.Handler(),
    ]

    server = rpc_service.Service.create(CONF.conductor.topic,
                                        conductor_id, endpoints,
                                        binary='magnum-conductor')
    workers = CONF.conductor.workers
    if not workers:
        workers = processutils.get_worker_count()
    launcher = service.launch(CONF, server, workers=workers)

    # NOTE(mnaser): We create the periodic tasks here so that they
    #               can be attached to the main process and not
    #               duplicated in all the children if multiple
    #               workers are being used.
    server.create_periodic_tasks()
    server.start()

    launcher.wait() 
开发者ID:openstack,项目名称:magnum,代码行数:37,代码来源:conductor.py

示例12: main

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def main():
    service.prepare_service(sys.argv)

    gmr.TextGuruMeditation.setup_autorun(version)

    # Enable object backporting via the conductor
    base.MagnumObject.indirection_api = base.MagnumObjectIndirectionAPI()

    app = api_app.load_app()

    # Setup OSprofiler for WSGI service
    profiler.setup('magnum-api', CONF.host)

    # SSL configuration
    use_ssl = CONF.api.enabled_ssl

    # Create the WSGI server and start it
    host, port = CONF.api.host, CONF.api.port

    LOG.info('Starting server in PID %s', os.getpid())
    LOG.debug("Configuration:")
    CONF.log_opt_values(LOG, logging.DEBUG)

    LOG.info('Serving on %(proto)s://%(host)s:%(port)s',
             dict(proto="https" if use_ssl else "http", host=host, port=port))

    workers = CONF.api.workers
    if not workers:
        workers = processutils.get_worker_count()
    LOG.info('Server will handle each request in a new process up to'
             ' %s concurrent processes', workers)
    serving.run_simple(host, port, app, processes=workers,
                       ssl_context=_get_ssl_configs(use_ssl)) 
开发者ID:openstack,项目名称:magnum,代码行数:35,代码来源:api.py

示例13: _get_connection

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def _get_connection(self):
        """Context manager providing a netmiko SSH connection object.

        This function hides the complexities of gracefully handling retrying
        failed connection attempts.
        """
        retry_exc_types = (paramiko.SSHException, EOFError)

        # Use tenacity to handle retrying.
        @tenacity.retry(
            # Log a message after each failed attempt.
            after=tenacity.after_log(LOG, logging.DEBUG),
            # Reraise exceptions if our final attempt fails.
            reraise=True,
            # Retry on SSH connection errors.
            retry=tenacity.retry_if_exception_type(retry_exc_types),
            # Stop after the configured timeout.
            stop=tenacity.stop_after_delay(
                int(self.ngs_config['ngs_ssh_connect_timeout'])),
            # Wait for the configured interval between attempts.
            wait=tenacity.wait_fixed(
                int(self.ngs_config['ngs_ssh_connect_interval'])),
        )
        def _create_connection():
            return netmiko.ConnectHandler(**self.config)

        # First, create a connection.
        try:
            net_connect = _create_connection()
        except tenacity.RetryError as e:
            LOG.error("Reached maximum SSH connection attempts, not retrying")
            raise exc.GenericSwitchNetmikoConnectError(
                config=device_utils.sanitise_config(self.config), error=e)
        except Exception as e:
            LOG.error("Unexpected exception during SSH connection")
            raise exc.GenericSwitchNetmikoConnectError(
                config=device_utils.sanitise_config(self.config), error=e)

        # Now yield the connection to the caller.
        with net_connect:
            yield net_connect 
开发者ID:openstack,项目名称:networking-generic-switch,代码行数:43,代码来源:__init__.py

示例14: check_for_setup_error

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def check_for_setup_error(self):

        try:
            # Log the source SHA for support.  Only do this with DEBUG.
            if LOG.isEnabledFor(log.DEBUG):
                LOG.debug('HPE3ParShareDriver SHA1: %s',
                          self.sha1_hash(HPE3ParShareDriver))
                LOG.debug('HPE3ParMediator SHA1: %s',
                          self.sha1_hash(hpe_3par_mediator.HPE3ParMediator))
        except Exception as e:
            # Don't let any exceptions during the SHA1 logging interfere
            # with startup.  This is just debug info to identify the source
            # code.  If it doesn't work, just log a debug message.
            LOG.debug('Source code SHA1 not logged due to: %s',
                      six.text_type(e)) 
开发者ID:openstack,项目名称:manila,代码行数:17,代码来源:hpe_3par_driver.py

示例15: wait

# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import DEBUG [as 别名]
def wait():
    CONF.log_opt_values(LOG, log.DEBUG)
    try:
        _launcher.wait()
    except KeyboardInterrupt:
        _launcher.stop()
    rpc.cleanup() 
开发者ID:openstack,项目名称:manila,代码行数:9,代码来源:service.py


注:本文中的oslo_log.log.DEBUG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。