Switch to oslo_log

vmware-nsx is currently using python logging module to
implement logging functionality.

This patch made a switch to oslo.log(logging for openstack projects)

Reference:-
http://docs.openstack.org/developer/oslo.log

Change-Id: Ibdb4f6ea0abc56cb98bdc57547bc3b4370f9875b
This commit is contained in:
Rajiv Kumar 2017-01-14 16:54:29 +05:30 committed by Adit Sarfaty
parent 5aca58fc08
commit 80fcf24d02
23 changed files with 37 additions and 38 deletions

View File

@ -12,10 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from oslo_config import cfg
from oslo_config import types
from oslo_log import log as logging
from neutron.db import l3_hamode_db

View File

@ -14,9 +14,8 @@
# under the License.
import logging
from osc_lib import utils
from oslo_log import log as logging
LOG = logging.getLogger(__name__)

View File

@ -13,14 +13,25 @@
# 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
import sys
from neutronclient import shell
from oslo_config import cfg
from oslo_log import log as logging
from vmware_nsx.shell import commands as cmd
logging.basicConfig(format='%(message)s', level=logging.INFO)
logging.getLogger('requests').setLevel(logging.WARNING)
# Oslo Logging uses INFO as default
# Use a simple format for the output
logging_format_string = '%(message)s'
logging.register_options(cfg.CONF)
logging.setup(cfg.CONF, "vmware-nsx")
cfg.CONF.set_override('logging_context_format_string',
logging_format_string)
cfg.CONF.set_override('logging_default_format_string',
logging_format_string)
cfg.CONF.set_override('logging_exception_prefix',
'')
class NsxManage(shell.NeutronShell):

View File

@ -12,9 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
import prettytable

View File

@ -12,13 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import six
import sys
from vmware_nsx._i18n import _LI, _
from neutron.callbacks import registry
from neutron.common import profiler # noqa
from oslo_log import log as logging
from vmware_nsx.shell import resources as nsxadmin
LOG = logging.getLogger(__name__)

View File

@ -13,11 +13,10 @@
# under the License.
import logging
from neutron.callbacks import registry
from neutron.db import l3_db
from neutron_lib import exceptions
from oslo_log import log as logging
from oslo_utils import uuidutils
from vmware_nsx._i18n import _LE, _LI

View File

@ -13,10 +13,10 @@
# under the License.
import logging
import pprint
from oslo_config import cfg
from oslo_log import log as logging
from vmware_nsx.shell.admin.plugins.common import constants
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils

View File

@ -13,7 +13,6 @@
# under the License.
import logging
import pprint
import textwrap
@ -28,6 +27,7 @@ import vmware_nsx.shell.resources as shell
from neutron.callbacks import registry
from neutron_lib import exceptions
from oslo_log import log as logging
from vmware_nsx._i18n import _LE, _LI
from vmware_nsx.common import nsxv_constants

View File

@ -15,11 +15,11 @@
import hashlib
import hmac
import logging
from neutron.callbacks import registry
from neutron.db import models_v2
from oslo_config import cfg
from oslo_log import log as logging
from vmware_nsx._i18n import _LE, _LI
from vmware_nsx.common import config

View File

@ -13,7 +13,7 @@
# under the License.
import logging
from oslo_log import log as logging
from oslo_serialization import jsonutils
import re
import xml.etree.ElementTree as et

View File

@ -13,8 +13,6 @@
# under the License.
import logging
from vmware_nsx.shell.admin.plugins.common import constants
import vmware_nsx.shell.admin.plugins.common.utils as admin_utils
import vmware_nsx.shell.admin.plugins.nsxv.resources.utils as utils
@ -23,6 +21,7 @@ import vmware_nsx.shell.resources as shell
from neutron.callbacks import registry
from neutron import context as n_context
from oslo_config import cfg
from oslo_log import log as logging
from vmware_nsx._i18n import _LE, _LI, _LW
from vmware_nsx.common import locking

View File

@ -13,7 +13,6 @@
# under the License.
import logging
import xml.etree.ElementTree as et
from neutron.callbacks import registry
@ -22,6 +21,7 @@ from neutron.db.models import securitygroup as sg_models
from neutron.db import models_v2
from neutron.db import securitygroups_db
from neutron.extensions import securitygroup as ext_sg
from oslo_log import log as logging
from vmware_nsx._i18n import _LE, _LI, _LW
from vmware_nsx.db import db as nsx_db

View File

@ -13,9 +13,6 @@
# under the License.
import logging
from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin.plugins.common import formatters
@ -29,6 +26,8 @@ from neutron_lib import exceptions
from vmware_nsx._i18n import _LE, _LI
from vmware_nsx.db import nsxv_db
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
nsxv = utils.get_nsxv_client()

View File

@ -12,12 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
import netaddr
from neutron.callbacks import registry
from neutron_lib import constants as const
from oslo_config import cfg
from oslo_log import log as logging
from vmware_nsx._i18n import _LE, _LI
from vmware_nsx.common import utils as nsx_utils

View File

@ -12,11 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from neutron.callbacks import registry
from neutron import context
from oslo_config import cfg
from oslo_log import log as logging
from vmware_nsx._i18n import _LE, _LI
from vmware_nsx.common import utils as nsx_utils

View File

@ -12,11 +12,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from neutron.callbacks import registry
from neutron_lib import constants as const
from oslo_config import cfg
from oslo_log import log as logging
from vmware_nsx._i18n import _LE, _LI
from vmware_nsx.common import utils as nsx_utils

View File

@ -13,8 +13,6 @@
# under the License.
import logging
from vmware_nsx._i18n import _LI
from vmware_nsx.db import db as nsx_db
from vmware_nsx.shell.admin.plugins.common import constants
@ -27,6 +25,7 @@ from vmware_nsxlib.v3 import exceptions as nsx_exc
from neutron.callbacks import registry
from neutron import context as neutron_context
from neutron.db import db_base_plugin_v2
from oslo_log import log as logging
LOG = logging.getLogger(__name__)

View File

@ -13,9 +13,8 @@
# under the License.
import logging
from oslo_config import cfg
from oslo_log import log as logging
from sqlalchemy.orm import exc
from vmware_nsx._i18n import _LE, _LI, _LW

View File

@ -13,8 +13,6 @@
# under the License.
import logging
from vmware_nsx._i18n import _LI
from vmware_nsx.db import db as nsx_db
from vmware_nsx.shell.admin.plugins.common import constants
@ -29,6 +27,7 @@ from neutron.callbacks import registry
from neutron import context as neutron_context
from neutron.db import db_base_plugin_v2
from neutron.db import l3_db
from oslo_log import log as logging
LOG = logging.getLogger(__name__)

View File

@ -12,13 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
import logging
from neutron.callbacks import registry
from neutron import context as neutron_context
from neutron.db import common_db_mixin as common_db
from neutron.db.models import securitygroup
from neutron.db import securitygroups_db
from oslo_log import log as logging
from vmware_nsx.common import utils
from vmware_nsx.db import db as nsx_db

View File

@ -24,7 +24,6 @@ TODO: Add support for other resources, ports, logical switches etc.
TODO: Autocomplete command line args
"""
import logging
import requests
import sys
@ -37,6 +36,7 @@ from vmware_nsx.common import config # noqa
from oslo_config import cfg
from oslo_log import _options
from oslo_log import log as logging
from vmware_nsx.shell.admin.plugins.common import constants
from vmware_nsx.shell.admin import version

View File

@ -15,10 +15,10 @@
import enum
import glob
import importlib
import logging
import os
from oslo_config import cfg
from oslo_log import log as logging
import requests
from vmware_nsx.common import config # noqa

View File

@ -14,12 +14,12 @@
# under the License.
import abc
import logging
import mock
import six
from oslo_config import cfg
from oslo_log import _options
from oslo_log import log as logging
from oslo_utils import uuidutils
from neutron.callbacks import registry