Added separate log level for Rally debugging

Default DEBUG log level produces a lot of output from off-site
  components, like OpenStack clients etc.
  This patch implements addition log level 'RALLYDEBUG' and cli/config
  options.

Change-Id: I58f29c5c69e23de297404a33e4e416e6844de4a3
This commit is contained in:
Oleh Anufriiev 2014-11-04 17:52:35 +02:00
parent f6c4f71a53
commit 7873ffb495
40 changed files with 96 additions and 39 deletions

View File

@ -19,7 +19,7 @@ import jsonschema
import six
from rally import exceptions
from rally.openstack.common import log as logging
from rally import log as logging
from rally import utils
LOG = logging.getLogger(__name__)

View File

@ -20,7 +20,7 @@ from rally.benchmark.scenarios import base as scenario_base
from rally.benchmark.scenarios.glance import utils as glance_utils
from rally import exceptions
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils as rutils

View File

@ -18,7 +18,7 @@ import novaclient.exceptions
from rally.benchmark.context import base
from rally.benchmark.context.cleanup import manager as resource_manager
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

View File

@ -19,7 +19,7 @@ from rally.benchmark.context.quotas import designate_quotas
from rally.benchmark.context.quotas import neutron_quotas
from rally.benchmark.context.quotas import nova_quotas
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils

View File

@ -16,7 +16,7 @@
from rally.benchmark.context import base
from rally import exceptions
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils as rutils

View File

@ -22,7 +22,7 @@ from rally.benchmark import types
from rally.benchmark import utils as bench_utils
from rally import exceptions
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils as rutils

View File

@ -19,7 +19,7 @@ from rally.benchmark.context import base
from rally.benchmark.context.cleanup import manager as resource_manager
from rally import exceptions
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils as rutils

View File

@ -17,7 +17,7 @@ from rally.benchmark.context.cleanup import manager as resource_manager
from rally.benchmark.scenarios import base as scenarios_base
from rally.benchmark.scenarios.glance import utils as glance_utils
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils as rutils

View File

@ -15,7 +15,7 @@
from rally.benchmark.context import base
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils

View File

@ -21,7 +21,7 @@ import tempfile
from rally.benchmark.context import base
from rally import exceptions
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import utils
from rally.verification.verifiers.tempest import config
from rally.verification.verifiers.tempest import tempest

View File

@ -24,8 +24,8 @@ from rally import broker
from rally import consts
from rally import exceptions
from rally.i18n import _
from rally import log as logging
from rally.objects import endpoint
from rally.openstack.common import log as logging
from rally import osclients
from rally import utils as rutils

View File

@ -16,7 +16,7 @@ from rally.benchmark.context import base
from rally.benchmark.context.cleanup import manager as resource_manager
from rally.benchmark.scenarios.cinder import utils as cinder_utils
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils as rutils

View File

@ -29,8 +29,8 @@ from rally.benchmark.sla import base as base_sla
from rally import consts
from rally import exceptions
from rally.i18n import _
from rally import log as logging
from rally.objects import endpoint
from rally.openstack.common import log as logging
from rally import osclients
from rally import utils as rutils

View File

@ -25,7 +25,7 @@ from rally.benchmark import types
from rally.benchmark import utils
from rally import consts
from rally import exceptions
from rally.openstack.common import log as logging
from rally import log as logging
from rally import osclients
from rally import utils as rutils

View File

@ -20,7 +20,7 @@ import time
from rally.benchmark.runners import base
from rally.benchmark import utils
from rally import consts
from rally.openstack.common import log as logging
from rally import log as logging
from rally import utils as rutils

View File

@ -20,7 +20,7 @@ import time
from rally.benchmark.runners import base
from rally import consts
from rally.openstack.common import log as logging
from rally import log as logging
from rally import utils as rutils

View File

@ -16,7 +16,7 @@
import netaddr
from rally.benchmark.scenarios import base
from rally.openstack.common import log as logging
from rally import log as logging
from rally.openstack.common import uuidutils as uid

View File

@ -23,7 +23,7 @@ from rally.benchmark import types as types
from rally.benchmark import validation
from rally import consts
from rally import exceptions as rally_exceptions
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

View File

@ -18,7 +18,7 @@ from rally.benchmark.scenarios.sahara import utils
from rally.benchmark import types
from rally.benchmark import validation
from rally import consts
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

View File

@ -17,7 +17,7 @@ from rally.benchmark.scenarios import base
from rally.benchmark.scenarios.sahara import utils
from rally.benchmark import validation
from rally import consts
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

View File

@ -19,7 +19,7 @@ from saharaclient.api import base as sahara_base
from rally.benchmark.scenarios import base
from rally.benchmark import utils as bench_utils
from rally import exceptions
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)
CONF = cfg.CONF

View File

@ -20,7 +20,7 @@ import time
from oslo.config import cfg
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
CONF = cfg.CONF

View File

@ -24,7 +24,7 @@ from oslo.config import cfg
from rally.aas.rest import app as rally_app
from rally.i18n import _
from rally.openstack.common import log
from rally import log
CONF = cfg.CONF

View File

@ -23,9 +23,9 @@ import sys
from oslo.config import cfg
from rally.i18n import _
from rally import log as logging
from rally.openstack.common.apiclient import exceptions
from rally.openstack.common import cliutils
from rally.openstack.common import log as logging
from rally import utils
from rally import version

View File

@ -22,7 +22,7 @@ from rally import consts
from rally.deploy.serverprovider import provider
from rally import exceptions
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import utils

View File

@ -19,8 +19,8 @@ from rally import consts
from rally.deploy import engine
from rally.deploy.serverprovider import provider
from rally.i18n import _
from rally import log as logging
from rally import objects
from rally.openstack.common import log as logging
from rally import utils

View File

@ -22,8 +22,8 @@ from rally.deploy.serverprovider import provider
from rally.deploy.serverprovider.providers import lxc
from rally import exceptions
from rally.i18n import _
from rally import log as logging
from rally import objects
from rally.openstack.common import log as logging
from rally import utils
LOG = logging.getLogger(__name__)

View File

@ -19,7 +19,7 @@ import time
import requests
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

View File

@ -23,7 +23,7 @@ import netaddr
from rally.deploy.serverprovider import provider
from rally import exceptions
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
from rally import utils

View File

@ -23,8 +23,8 @@ from rally.benchmark import utils as benchmark_utils
from rally.deploy.serverprovider import provider
from rally import exceptions
from rally.i18n import _
from rally import log as logging
from rally.objects import endpoint
from rally.openstack.common import log as logging
from rally import osclients

View File

@ -19,7 +19,7 @@ import sys
from oslo.config import cfg
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

57
rally/log.py Normal file
View File

@ -0,0 +1,57 @@
# Copyright 2013: Mirantis Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# 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 logging
from oslo.config import cfg
from rally.openstack.common import log as oslogging
common_cli_opts = [cfg.BoolOpt("rally-debug",
default=False,
help="Print debugging output only for Rally. "
"Off-site components stay quiet.")]
CONF = cfg.CONF
CONF.register_cli_opts(common_cli_opts)
logging.RDEBUG = logging.DEBUG + 1
logging.addLevelName(logging.RDEBUG, "RALLYDEBUG")
def setup(product_name, version="unknown"):
dbg_color = oslogging.ColorHandler.LEVEL_COLORS[logging.DEBUG]
oslogging.ColorHandler.LEVEL_COLORS[logging.RDEBUG] = dbg_color
oslogging.setup(product_name, version)
if CONF.rally_debug:
oslogging.getLogger(None).logger.setLevel(logging.RDEBUG)
def getLogger(name="unknown", version="unknown"):
if name not in oslogging._loggers:
oslogging._loggers[name] = RallyContextAdapter(logging.getLogger(name),
name,
version)
return oslogging._loggers[name]
class RallyContextAdapter(oslogging.ContextAdapter):
def debug(self, msg, *args, **kwargs):
self.log(logging.RDEBUG, msg, *args, **kwargs)

View File

@ -19,8 +19,8 @@ from rally.benchmark import engine
from rally import consts
from rally import deploy
from rally import exceptions
from rally import log as logging
from rally import objects
from rally.openstack.common import log as logging
from rally.verification.verifiers.tempest import tempest
LOG = logging.getLogger(__name__)

View File

@ -65,7 +65,7 @@ import time
import paramiko
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
LOG = logging.getLogger(__name__)

View File

@ -29,7 +29,7 @@ from sphinx.util import docstrings
from rally import exceptions
from rally.i18n import _
from rally.openstack.common import log as logging
from rally import log as logging
CONF = cfg.CONF
LOG = logging.getLogger(__name__)

View File

@ -15,7 +15,6 @@
import datetime
import inspect
import logging
import os
import time
import urlparse
@ -27,6 +26,7 @@ from six.moves import configparser
from rally import db
from rally import exceptions
from rally.i18n import _
from rally import log as logging
from rally.objects import endpoint
from rally import osclients