當前位置: 首頁>>代碼示例>>Python>>正文


Python log.setup方法代碼示例

本文整理匯總了Python中oslo_log.log.setup方法的典型用法代碼示例。如果您正苦於以下問題:Python log.setup方法的具體用法?Python log.setup怎麽用?Python log.setup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在oslo_log.log的用法示例。


在下文中一共展示了log.setup方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: init_application

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
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') 
開發者ID:openstack,項目名稱:designate,代碼行數:20,代碼來源:wsgi.py

示例2: setup

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def setup(product_name):
    log.setup(CONF, product_name)

    if CONF.logging_serial_port_settings:
        try:
            serialportlog = SerialPortHandler()
            log_root = log.getLogger(product_name).logger
            log_root.addHandler(serialportlog)

            datefmt = CONF.log_date_format
            serialportlog.setFormatter(
                formatters.ContextFormatter(project=product_name,
                                            datefmt=datefmt))
        except serial.SerialException:
            LOG.warn("Serial port: {0} could not be opened".format(
                     CONF.logging_serial_port_settings)) 
開發者ID:cloudbase,項目名稱:cloudbase-init,代碼行數:18,代碼來源:log.py

示例3: _log_setup

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
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 
開發者ID:ntt-sic,項目名稱:masakari,代碼行數:27,代碼來源:masakari_config.py

示例4: configure_wsgi

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def configure_wsgi():
    # NOTE(hberaud): Call reset to ensure the ConfigOpts object doesn't
    # already contain registered options if the app is reloaded.
    CONF.reset()
    config.parse_args()
    config.set_config_defaults()
    logging.setup(CONF, 'searchlight')
    gmr.TextGuruMeditation.setup_autorun(version)
    utils.register_plugin_opts()

    # Fail fast if service policy files aren't found
    service_policies.check_policy_files()

    if CONF.profiler.enabled:
        _notifier = osprofiler.notifier.create("Messaging",
                                               notifier.messaging, {},
                                               notifier.get_transport(),
                                               "searchlight", "search",
                                               CONF.api.bind_host)
        osprofiler.notifier.set(_notifier)
    else:
        osprofiler.web.disable() 
開發者ID:openstack,項目名稱:searchlight,代碼行數:24,代碼來源:api.py

示例5: main

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
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() 
開發者ID:openstack,項目名稱:manila,代碼行數:23,代碼來源:share.py

示例6: setUp

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def setUp(self):
        super(LogLevelTestCase, self).setUp()
        levels = self.CONF.default_log_levels
        info_level = 'nova-test'
        warn_level = 'nova-not-debug'
        other_level = 'nova-below-debug'
        trace_level = 'nova-trace'
        levels.append(info_level + '=INFO')
        levels.append(warn_level + '=WARN')
        levels.append(other_level + '=7')
        levels.append(trace_level + '=TRACE')
        self.config(default_log_levels=levels)
        log.setup(self.CONF, 'testing')
        self.log = log.getLogger(info_level)
        self.log_no_debug = log.getLogger(warn_level)
        self.log_below_debug = log.getLogger(other_level)
        self.log_trace = log.getLogger(trace_level) 
開發者ID:openstack,項目名稱:oslo.log,代碼行數:19,代碼來源:test_log.py

示例7: main

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def main():
    api_config.parse_args(sys.argv)
    logging.setup(CONF, "masakari")
    log = logging.getLogger(__name__)
    objects.register_all()

    launcher = service.process_launcher()
    try:
        server = service.WSGIService("masakari_api", use_ssl=CONF.use_ssl)
        launcher.launch_service(server, workers=server.workers or 1)
    except exception.PasteAppNotFound as ex:
        log.error("Failed to start ``masakari_api`` service. Error: %s",
                  six.text_type(ex))
        sys.exit(1)

    launcher.wait() 
開發者ID:openstack,項目名稱:masakari,代碼行數:18,代碼來源:api.py

示例8: initialize_application

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [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

示例9: main_app

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def main_app(func):
    def _wrapper(global_config, **local_conf):
        # Queuing initialization
        queue.init(CONF, is_server_side=False)

        # Configure oslo logging and configuration services.
        log.setup(CONF, 'barbican')

        config.setup_remote_pydev_debug()

        # Initializing the database engine and session factory before the app
        # starts ensures we don't lose requests due to lazy initialization of
        # db connections.
        repositories.setup_database_engine_and_factory()

        wsgi_app = func(global_config, **local_conf)

        if newrelic_loaded:
            wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app)
        LOG = log.getLogger(__name__)
        LOG.info(u._LI('Barbican app created and initialized'))
        return wsgi_app
    return _wrapper 
開發者ID:cloud-security-research,項目名稱:sgx-kms,代碼行數:25,代碼來源:app.py

示例10: main

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def main():
    try:
        CONF = config.CONF

        # Import and configure logging.
        log.setup(CONF, 'barbican')
        LOG = log.getLogger(__name__)
        LOG.debug("Booting up Barbican worker node...")

        # Queuing initialization
        queue.init(CONF)

        service.launch(
            CONF,
            server.TaskServer(),
            workers=CONF.queue.asynchronous_workers
        ).wait()
    except RuntimeError as e:
        fail(1, e) 
開發者ID:cloud-security-research,項目名稱:sgx-kms,代碼行數:21,代碼來源:worker.py

示例11: main

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def main():
    try:
        CONF = config.CONF

        # Import and configure logging.
        log.setup(CONF, 'barbican-retry-scheduler')
        LOG = log.getLogger(__name__)
        LOG.debug("Booting up Barbican worker retry/scheduler node...")

        # Queuing initialization (as a client only).
        queue.init(CONF, is_server_side=False)

        service.launch(
            CONF,
            retry_scheduler.PeriodicServer()
        ).wait()
    except RuntimeError as e:
        fail(1, e) 
開發者ID:cloud-security-research,項目名稱:sgx-kms,代碼行數:20,代碼來源:retry_scheduler.py

示例12: main

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def main():
    try:
        CONF = config.CONF
        CONF(sys.argv[1:], project='barbican',
             version=version.version_info.version_string)

        # Import and configure logging.
        log.setup(CONF, 'barbican')
        LOG = log.getLogger(__name__)
        LOG.debug("Booting up Barbican worker node...")

        # Queuing initialization
        queue.init(CONF)

        service.launch(
            CONF,
            server.TaskServer(),
            workers=CONF.queue.asynchronous_workers,
            restart_method='mutate'
        ).wait()
    except RuntimeError as e:
        fail(1, e) 
開發者ID:openstack,項目名稱:barbican,代碼行數:24,代碼來源:worker.py

示例13: prepare_service

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def prepare_service(argv=None):
    if argv is None:
        argv = []
    log.register_options(CONF)
    config.parse_args(argv)
    config.set_config_defaults()
    log.setup(CONF, 'zun')
    # TODO(yuanying): Uncomment after objects are implemented
    # objects.register_all() 
開發者ID:openstack,項目名稱:zun,代碼行數:11,代碼來源:service.py

示例14: main

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def main():
    config.parse_args(sys.argv)
    logging.setup(config.CONF, "ec2api")

    server = s3server.get_wsgi_server()
    service.serve(server)
    service.wait() 
開發者ID:openstack,項目名稱:ec2-api,代碼行數:9,代碼來源:api_s3.py

示例15: main

# 需要導入模塊: from oslo_log import log [as 別名]
# 或者: from oslo_log.log import setup [as 別名]
def main():
    CONF.register_cli_opt(command_opt)
    config.parse_args(sys.argv)
    log.setup(CONF, "ec2api")

    try:
        CONF.command.func()
    except Exception as e:
        sys.exit("ERROR: %s" % e) 
開發者ID:openstack,項目名稱:ec2-api,代碼行數:11,代碼來源:manage.py


注:本文中的oslo_log.log.setup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。