• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python log.getLogger函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tempest.openstack.common.log.getLogger函数的典型用法代码示例。如果您正苦于以下问题:Python getLogger函数的具体用法?Python getLogger怎么用?Python getLogger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: __init__

    def __init__(self):
        """Initialize a configuration from a conf directory and conf file."""
        config_files = []
        failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE

        # Environment variables override defaults...
        conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
                                  self.DEFAULT_CONFIG_DIR)
        conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)

        path = os.path.join(conf_dir, conf_file)

        if not (os.path.isfile(path) or
                'TEMPEST_CONFIG_DIR' in os.environ or
                'TEMPEST_CONFIG' in os.environ):
            path = failsafe_path

        if not os.path.exists(path):
            msg = "Config file %s not found" % path
            print(RuntimeError(msg), file=sys.stderr)
        else:
            config_files.append(path)

        cfg.CONF([], project='tempest', default_config_files=config_files)
        logging.setup('tempest')
        LOG = logging.getLogger('tempest')
        LOG.info("Using tempest config file %s" % path)

        register_compute_opts(cfg.CONF)
        register_identity_opts(cfg.CONF)
        register_image_opts(cfg.CONF)
        register_network_opts(cfg.CONF)
        register_volume_opts(cfg.CONF)
        register_object_storage_opts(cfg.CONF)
        register_orchestration_opts(cfg.CONF)
        register_dashboard_opts(cfg.CONF)
        register_boto_opts(cfg.CONF)
        register_compute_admin_opts(cfg.CONF)
        register_stress_opts(cfg.CONF)
        register_scenario_opts(cfg.CONF)
        register_service_available_opts(cfg.CONF)
        register_debug_opts(cfg.CONF)
        self.compute = cfg.CONF.compute
        self.identity = cfg.CONF.identity
        self.images = cfg.CONF.image
        self.network = cfg.CONF.network
        self.volume = cfg.CONF.volume
        self.object_storage = cfg.CONF['object-storage']
        self.orchestration = cfg.CONF.orchestration
        self.dashboard = cfg.CONF.dashboard
        self.boto = cfg.CONF.boto
        self.compute_admin = cfg.CONF['compute-admin']
        self.stress = cfg.CONF.stress
        self.scenario = cfg.CONF.scenario
        self.service_available = cfg.CONF.service_available
        self.debug = cfg.CONF.debug
        if not self.compute_admin.username:
            self.compute_admin.username = self.identity.admin_username
            self.compute_admin.password = self.identity.admin_password
            self.compute_admin.tenant_name = self.identity.admin_tenant_name
开发者ID:aimonb,项目名称:tempest,代码行数:60,代码来源:config.py


示例2: __init__

    def __init__(self, parse_conf=True):
        """Initialize a configuration from a conf directory and conf file."""
        super(TempestConfigPrivate, self).__init__()
        config_files = []
        failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE

        # Environment variables override defaults...
        conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
                                  self.DEFAULT_CONFIG_DIR)
        conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)

        path = os.path.join(conf_dir, conf_file)

        if not os.path.isfile(path):
            path = failsafe_path

        # only parse the config file if we expect one to exist. This is needed
        # to remove an issue with the config file up to date checker.
        if parse_conf:
            config_files.append(path)

        cfg.CONF([], project='tempest', default_config_files=config_files)
        logging.setup('tempest')
        LOG = logging.getLogger('tempest')
        LOG.info("Using tempest config file %s" % path)
        register_opts()
        self._set_attrs()
        if parse_conf:
            cfg.CONF.log_opt_values(LOG, std_logging.DEBUG)
开发者ID:seacrib,项目名称:tempest,代码行数:29,代码来源:config.py


示例3: setUp

    def setUp(self, **kwargs):
        method = kwargs['test_method'].split('.')
        self.test_method = method.pop()
        self.klass = importutils.import_class('.'.join(method))
        self.logger = logging.getLogger('.'.join(method))
        # valid options are 'process', 'application' , 'action'
        self.class_setup_per = kwargs.get('class_setup_per',
                                          SetUpClassRunTime.process)
        SetUpClassRunTime.validate(self.class_setup_per)

        if self.class_setup_per == SetUpClassRunTime.application:
            self.klass.setUpClass()
        self.setupclass_called = False
开发者ID:AminaMseddi,项目名称:tempest,代码行数:13,代码来源:unit_test.py


示例4: SimpleReadOnlyKeystoneClientTest

#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

import re

from tempest import cli
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging

CONF = config.CONF


LOG = logging.getLogger(__name__)


class SimpleReadOnlyKeystoneClientTest(cli.ClientTestBase):
    """Basic, read-only tests for Keystone CLI client.

    Checks return values and output of read-only commands.
    These tests do not presume any content, nor do they create
    their own. They only verify the structure of output if present.
    """

    def test_admin_fake_action(self):
        self.assertRaises(exceptions.CommandFailed,
                          self.keystone,
                          'this-does-not-exist')
开发者ID:BhargavaRegalla,项目名称:tempest,代码行数:30,代码来源:test_keystone.py


示例5: decision_maker

def decision_maker():
    A_I_IMAGES_READY = True  # ari,ami,aki
    S3_CAN_CONNECT_ERROR = None
    EC2_CAN_CONNECT_ERROR = None
    secret_matcher = re.compile("[A-Za-z0-9+/]{32,}")  # 40 in other system
    id_matcher = re.compile("[A-Za-z0-9]{20,}")

    def all_read(*args):
        return all(map(have_effective_read_access, args))

    config = tempest.config.TempestConfig()
    materials_path = config.boto.s3_materials_path
    ami_path = materials_path + os.sep + config.boto.ami_manifest
    aki_path = materials_path + os.sep + config.boto.aki_manifest
    ari_path = materials_path + os.sep + config.boto.ari_manifest

    A_I_IMAGES_READY = all_read(ami_path, aki_path, ari_path)
    boto_logger = logging.getLogger('boto')
    level = boto_logger.logger.level
    boto_logger.logger.setLevel(orig_logging.CRITICAL)  # suppress logging
                                                        # for these

    def _cred_sub_check(connection_data):
        if not id_matcher.match(connection_data["aws_access_key_id"]):
            raise Exception("Invalid AWS access Key")
        if not secret_matcher.match(connection_data["aws_secret_access_key"]):
            raise Exception("Invalid AWS secret Key")
        raise Exception("Unknown (Authentication?) Error")
    openstack = tempest.clients.Manager()
    try:
        if urlparse.urlparse(config.boto.ec2_url).hostname is None:
            raise Exception("Failed to get hostname from the ec2_url")
        ec2client = openstack.ec2api_client
        try:
            ec2client.get_all_regions()
        except exception.BotoServerError as exc:
                if exc.error_code is None:
                    raise Exception("EC2 target does not looks EC2 service")
                _cred_sub_check(ec2client.connection_data)

    except keystoneclient.exceptions.Unauthorized:
        EC2_CAN_CONNECT_ERROR = "AWS credentials not set," +\
                                " faild to get them even by keystoneclient"
    except Exception as exc:
        EC2_CAN_CONNECT_ERROR = str(exc)

    try:
        if urlparse.urlparse(config.boto.s3_url).hostname is None:
            raise Exception("Failed to get hostname from the s3_url")
        s3client = openstack.s3_client
        try:
            s3client.get_bucket("^INVALID*#()@INVALID.")
        except exception.BotoServerError as exc:
            if exc.status == 403:
                _cred_sub_check(s3client.connection_data)
    except Exception as exc:
        S3_CAN_CONNECT_ERROR = str(exc)
    except keystoneclient.exceptions.Unauthorized:
        S3_CAN_CONNECT_ERROR = "AWS credentials not set," +\
                               " faild to get them even by keystoneclient"
    boto_logger.logger.setLevel(level)
    return {'A_I_IMAGES_READY': A_I_IMAGES_READY,
            'S3_CAN_CONNECT_ERROR': S3_CAN_CONNECT_ERROR,
            'EC2_CAN_CONNECT_ERROR': EC2_CAN_CONNECT_ERROR}
开发者ID:pradeepkumars,项目名称:tempest,代码行数:64,代码来源:test.py


示例6: setup_logging

def setup_logging():
    global LOG
    logging.setup(__name__)
    LOG = logging.getLogger(__name__)
开发者ID:ebagdasa,项目名称:tempest,代码行数:4,代码来源:javelin.py


示例7: __init__

    def __init__(self):
        """Initialize a configuration from a conf directory and conf file."""
        config_files = []
        failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE

        # Environment variables override defaults...
        conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
                                  self.DEFAULT_CONFIG_DIR)
        conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)

        path = os.path.join(conf_dir, conf_file)

        if not (os.path.isfile(path) or
                'TEMPEST_CONFIG_DIR' in os.environ or
                'TEMPEST_CONFIG' in os.environ):
            path = failsafe_path

        if not os.path.exists(path):
            msg = "Config file %s not found" % path
            print(RuntimeError(msg), file=sys.stderr)
        else:
            config_files.append(path)

        cfg.CONF([], project='tempest', default_config_files=config_files)
        logging.setup('tempest')
        LOG = logging.getLogger('tempest')
        LOG.info("Using tempest config file %s" % path)

        register_opt_group(cfg.CONF, compute_group, ComputeGroup)
        register_opt_group(cfg.CONF, compute_features_group,
                           ComputeFeaturesGroup)
        register_opt_group(cfg.CONF, identity_group, IdentityGroup)
        register_opt_group(cfg.CONF, image_group, ImageGroup)
        register_opt_group(cfg.CONF, image_feature_group, ImageFeaturesGroup)
        register_opt_group(cfg.CONF, network_group, NetworkGroup)
        register_opt_group(cfg.CONF, network_feature_group,
                           NetworkFeaturesGroup)
        register_opt_group(cfg.CONF, volume_group, VolumeGroup)
        register_opt_group(cfg.CONF, volume_feature_group,
                           VolumeFeaturesGroup)
        register_opt_group(cfg.CONF, object_storage_group, ObjectStoreGroup)
        register_opt_group(cfg.CONF, object_storage_feature_group,
                           ObjectStoreFeaturesGroup)
        register_opt_group(cfg.CONF, orchestration_group, OrchestrationGroup)
        register_opt_group(cfg.CONF, dashboard_group, DashboardGroup)
        register_opt_group(cfg.CONF, boto_group, BotoGroup)
        register_opt_group(cfg.CONF, compute_admin_group, ComputeAdminGroup)
        register_opt_group(cfg.CONF, stress_group, StressGroup)
        register_opt_group(cfg.CONF, scenario_group, ScenarioGroup)
        register_opt_group(cfg.CONF, service_available_group,
                           ServiceAvailableGroup)
        register_opt_group(cfg.CONF, debug_group, DebugGroup)
        self.compute = cfg.CONF.compute
        self.compute_feature_enabled = cfg.CONF['compute-feature-enabled']
        self.identity = cfg.CONF.identity
        self.images = cfg.CONF.image
        self.image_feature_enabled = cfg.CONF['image-feature-enabled']
        self.network = cfg.CONF.network
        self.network_feature_enabled = cfg.CONF['network-feature-enabled']
        self.volume = cfg.CONF.volume
        self.volume_feature_enabled = cfg.CONF['volume-feature-enabled']
        self.object_storage = cfg.CONF['object-storage']
        self.object_storage_feature_enabled = cfg.CONF[
            'object-storage-feature-enabled']
        self.orchestration = cfg.CONF.orchestration
        self.dashboard = cfg.CONF.dashboard
        self.boto = cfg.CONF.boto
        self.compute_admin = cfg.CONF['compute-admin']
        self.stress = cfg.CONF.stress
        self.scenario = cfg.CONF.scenario
        self.service_available = cfg.CONF.service_available
        self.debug = cfg.CONF.debug
        if not self.compute_admin.username:
            self.compute_admin.username = self.identity.admin_username
            self.compute_admin.password = self.identity.admin_password
            self.compute_admin.tenant_name = self.identity.admin_tenant_name
开发者ID:armando-migliaccio,项目名称:tempest,代码行数:76,代码来源:config.py


示例8: __init__

    def __init__(self, parse_conf=True):
        """Initialize a configuration from a conf directory and conf file."""
        super(TempestConfigPrivate, self).__init__()
        config_files = []
        failsafe_path = "/etc/tempest/" + self.DEFAULT_CONFIG_FILE

        # Environment variables override defaults...
        conf_dir = os.environ.get('TEMPEST_CONFIG_DIR',
                                  self.DEFAULT_CONFIG_DIR)
        conf_file = os.environ.get('TEMPEST_CONFIG', self.DEFAULT_CONFIG_FILE)

        path = os.path.join(conf_dir, conf_file)

        if not os.path.isfile(path):
            path = failsafe_path

        # only parse the config file if we expect one to exist. This is needed
        # to remove an issue with the config file up to date checker.
        if parse_conf:
            config_files.append(path)

        cfg.CONF([], project='tempest', default_config_files=config_files)
        logging.setup('tempest')
        LOG = logging.getLogger('tempest')
        LOG.info("Using tempest config file %s" % path)

        register_opt_group(cfg.CONF, compute_group, ComputeGroup)
        register_opt_group(cfg.CONF, compute_features_group,
                           ComputeFeaturesGroup)
        register_opt_group(cfg.CONF, identity_group, IdentityGroup)
        register_opt_group(cfg.CONF, identity_feature_group,
                           IdentityFeatureGroup)
        register_opt_group(cfg.CONF, image_group, ImageGroup)
        register_opt_group(cfg.CONF, image_feature_group, ImageFeaturesGroup)
        register_opt_group(cfg.CONF, network_group, NetworkGroup)
        register_opt_group(cfg.CONF, network_feature_group,
                           NetworkFeaturesGroup)
        register_opt_group(cfg.CONF, volume_group, VolumeGroup)
        register_opt_group(cfg.CONF, volume_feature_group,
                           VolumeFeaturesGroup)
        register_opt_group(cfg.CONF, object_storage_group, ObjectStoreGroup)
        register_opt_group(cfg.CONF, object_storage_feature_group,
                           ObjectStoreFeaturesGroup)
        register_opt_group(cfg.CONF, orchestration_group, OrchestrationGroup)
        register_opt_group(cfg.CONF, telemetry_group, TelemetryGroup)
        register_opt_group(cfg.CONF, dashboard_group, DashboardGroup)
        register_opt_group(cfg.CONF, data_processing_group,
                           DataProcessingGroup)
        register_opt_group(cfg.CONF, boto_group, BotoGroup)
        register_opt_group(cfg.CONF, compute_admin_group, ComputeAdminGroup)
        register_opt_group(cfg.CONF, stress_group, StressGroup)
        register_opt_group(cfg.CONF, scenario_group, ScenarioGroup)
        register_opt_group(cfg.CONF, service_available_group,
                           ServiceAvailableGroup)
        register_opt_group(cfg.CONF, debug_group, DebugGroup)
        register_opt_group(cfg.CONF, baremetal_group, BaremetalGroup)
        register_opt_group(cfg.CONF, input_scenario_group, InputScenarioGroup)
        register_opt_group(cfg.CONF, cli_group, CLIGroup)
        self.compute = cfg.CONF.compute
        self.compute_feature_enabled = cfg.CONF['compute-feature-enabled']
        self.identity = cfg.CONF.identity
        self.identity_feature_enabled = cfg.CONF['identity-feature-enabled']
        self.images = cfg.CONF.image
        self.image_feature_enabled = cfg.CONF['image-feature-enabled']
        self.network = cfg.CONF.network
        self.network_feature_enabled = cfg.CONF['network-feature-enabled']
        self.volume = cfg.CONF.volume
        self.volume_feature_enabled = cfg.CONF['volume-feature-enabled']
        self.object_storage = cfg.CONF['object-storage']
        self.object_storage_feature_enabled = cfg.CONF[
            'object-storage-feature-enabled']
        self.orchestration = cfg.CONF.orchestration
        self.telemetry = cfg.CONF.telemetry
        self.dashboard = cfg.CONF.dashboard
        self.data_processing = cfg.CONF.data_processing
        self.boto = cfg.CONF.boto
        self.compute_admin = cfg.CONF['compute-admin']
        self.stress = cfg.CONF.stress
        self.scenario = cfg.CONF.scenario
        self.service_available = cfg.CONF.service_available
        self.debug = cfg.CONF.debug
        self.baremetal = cfg.CONF.baremetal
        self.input_scenario = cfg.CONF['input-scenario']
        self.cli = cfg.CONF.cli
        if not self.compute_admin.username:
            self.compute_admin.username = self.identity.admin_username
            self.compute_admin.password = self.identity.admin_password
            self.compute_admin.tenant_name = self.identity.admin_tenant_name
开发者ID:LIS,项目名称:LIS-Tempest,代码行数:88,代码来源:config.py


示例9: __init__

 def __init__(self, manager, max_runs=None, stop_on_error=False):
     full_cname = self.__module__ + "." + self.__class__.__name__
     self.logger = logging.getLogger(full_cname)
     self.manager = manager
     self.max_runs = max_runs
     self.stop_on_error = stop_on_error
开发者ID:notmyname,项目名称:tempest,代码行数:6,代码来源:stressaction.py


示例10: setUpClass

 def setUpClass(cls):
     cls.LOG = logging.getLogger(cls._get_full_case_name())
     super(BaseTestCase, cls).setUpClass()
开发者ID:Vikash082,项目名称:neutron-lbaas,代码行数:3,代码来源:base.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python log.setup函数代码示例发布时间:2022-05-27
下一篇:
Python test_utils.find_test_caller函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap