Logging module cleanup

Replaced logging with openstack.common.log
Removed imports where logging is not used

Fixes bug #1095541

Change-Id: I5b03d9697dde3ef3520f67d1d8166f7af7689551
This commit is contained in:
Zhongyue Luo 2013-01-03 14:31:49 +08:00
parent b5138f28a5
commit f78b0f9b05
17 changed files with 88 additions and 108 deletions

View File

@ -63,7 +63,6 @@ Human Alphabetical Order Examples
Example:: Example::
import httplib import httplib
import logging
import random import random
import StringIO import StringIO
import time import time
@ -76,6 +75,7 @@ Example::
from quantum.api import ports from quantum.api import ports
from quantum.db import models from quantum.db import models
from quantum.extensions import multiport from quantum.extensions import multiport
from quantum.openstack.common import log as logging
import quantum.manager import quantum.manager
from quantum import service from quantum import service

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack, LLC # Copyright (c) 2010 OpenStack, LLC
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
@ -37,7 +37,6 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import logging
import sys import sys
import unittest import unittest
@ -259,13 +258,6 @@ class QuantumTestRunner(core.TextTestRunner):
def run_tests(c=None): def run_tests(c=None):
logger = logging.getLogger()
hdlr = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.DEBUG)
# NOTE(bgh): I'm not entirely sure why but nose gets confused here when # NOTE(bgh): I'm not entirely sure why but nose gets confused here when
# calling run_tests from a plugin directory run_tests.py (instead of the # calling run_tests from a plugin directory run_tests.py (instead of the
# main run_tests.py). It will call run_tests with no arguments and the # main run_tests.py). It will call run_tests with no arguments and the

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Nachi Ueno, NTT MCL, Inc. # Copyright 2012, Nachi Ueno, NTT MCL, Inc.
# All Rights Reserved. # All Rights Reserved.
# #
@ -15,14 +15,13 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
from cliff import lister from cliff import lister
from quantumclient.common import utils from quantumclient.common import utils
from quantumclient.quantum.v2_0.port import _format_fixed_ips from quantumclient.quantum.v2_0.port import _format_fixed_ips
from quantumclient.quantum.v2_0 import QuantumCommand from quantumclient.quantum.v2_0 import QuantumCommand
from quantum.openstack.common import log as logging
class ProbeCommand(QuantumCommand): class ProbeCommand(QuantumCommand):
log = logging.getLogger(__name__ + '.ProbeCommand') log = logging.getLogger(__name__ + '.ProbeCommand')

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Nachi Ueno, NTT MCL, Inc. # Copyright 2012, Nachi Ueno, NTT MCL, Inc.
# All Rights Reserved. # All Rights Reserved.
# #
@ -17,7 +17,6 @@
import datetime import datetime
import errno import errno
import logging
import os import os
import shlex import shlex
import socket import socket
@ -32,9 +31,11 @@ from quantum.agent.linux import ip_lib
from quantum.agent.linux import utils from quantum.agent.linux import utils
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import importutils from quantum.openstack.common import importutils
from quantum.openstack.common import log as logging
from quantumclient.v2_0 import client from quantumclient.v2_0 import client
LOG = logging.getLogger('test-agent')
LOG = logging.getLogger(__name__)
DEVICE_OWNER_PROBE = 'network:probe' DEVICE_OWNER_PROBE = 'network:probe'

View File

@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 Cisco Systems, Inc. All rights reserved. # Copyright 2011 Cisco Systems, Inc.
# All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # 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 # not use this file except in compliance with the License. You may obtain
@ -16,8 +17,6 @@
# #
# @author: Ying Liu, Cisco Systems, Inc. # @author: Ying Liu, Cisco Systems, Inc.
import logging
from webob import exc from webob import exc
from quantum.api import api_common as common from quantum.api import api_common as common
@ -29,9 +28,6 @@ from quantum.plugins.cisco.common import cisco_faults as faults
from quantum import wsgi from quantum import wsgi
LOG = logging.getLogger('quantum.api.credentials')
class Credential(object): class Credential(object):
"""extension class Credential""" """extension class Credential"""
def __init__(self): def __init__(self):

View File

@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 Cisco Systems, Inc. All rights reserved. # Copyright 2011 Cisco Systems, Inc.
# All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # 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 # not use this file except in compliance with the License. You may obtain
@ -16,8 +17,6 @@
# #
# @author: Ying Liu, Cisco Systems, Inc. # @author: Ying Liu, Cisco Systems, Inc.
import logging
from webob import exc from webob import exc
from quantum.api import api_common as common from quantum.api import api_common as common
@ -28,9 +27,6 @@ from quantum.plugins.cisco.common import cisco_faults as faults
from quantum import wsgi from quantum import wsgi
LOG = logging.getLogger('quantum.api.multiports')
class Multiport(object): class Multiport(object):
"""extension class multiport""" """extension class multiport"""
def __init__(self): def __init__(self):

View File

@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 Cisco Systems, Inc. All rights reserved. # Copyright 2011 Cisco Systems, Inc.
# All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # 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 # not use this file except in compliance with the License. You may obtain
@ -16,8 +17,6 @@
# #
# @author: Ying Liu, Cisco Systems, Inc. # @author: Ying Liu, Cisco Systems, Inc.
import logging
from webob import exc from webob import exc
from quantum.api import api_common as common from quantum.api import api_common as common
@ -29,9 +28,6 @@ from quantum.plugins.cisco.common import cisco_faults as faults
from quantum import wsgi from quantum import wsgi
LOG = logging.getLogger('quantum.api.qoss')
class Qos(object): class Qos(object):
"""Qos extension file""" """Qos extension file"""
def __init__(self): def __init__(self):

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Nachi Ueno, NTT MCL, Inc. # Copyright 2012, Nachi Ueno, NTT MCL, Inc.
# All Rights Reserved. # All Rights Reserved.
# #
@ -15,8 +15,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
from quantum.api.v2 import attributes from quantum.api.v2 import attributes
from quantum.common import exceptions as exc from quantum.common import exceptions as exc
from quantum.common.utils import find_config_file from quantum.common.utils import find_config_file
@ -27,13 +25,15 @@ from quantum.db import models_v2
from quantum.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER) from quantum.extensions.flavor import (FLAVOR_NETWORK, FLAVOR_ROUTER)
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import importutils from quantum.openstack.common import importutils
from quantum.openstack.common import log as logging
from quantum.plugins.metaplugin.common import config from quantum.plugins.metaplugin.common import config
from quantum.plugins.metaplugin import meta_db_v2 from quantum.plugins.metaplugin import meta_db_v2
from quantum.plugins.metaplugin.meta_models_v2 import (NetworkFlavor, from quantum.plugins.metaplugin.meta_models_v2 import (NetworkFlavor,
RouterFlavor) RouterFlavor)
from quantum import policy from quantum import policy
LOG = logging.getLogger("metaplugin")
LOG = logging.getLogger(__name__)
# Metaplugin Exceptions # Metaplugin Exceptions

View File

@ -1,5 +1,5 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012, Nachi Ueno, NTT MCL, Inc. # Copyright 2012, Nachi Ueno, NTT MCL, Inc.
# All Rights Reserved. # All Rights Reserved.
# #
@ -15,13 +15,12 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
from quantum.db import api as db from quantum.db import api as db
from quantum.db import db_base_plugin_v2 from quantum.db import db_base_plugin_v2
from quantum.db import l3_db from quantum.db import l3_db
from quantum.db import models_v2 from quantum.db import models_v2
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import log as logging
from quantumclient.common import exceptions from quantumclient.common import exceptions
from quantumclient.v2_0 import client from quantumclient.v2_0 import client

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC. # Copyright (c) 2011 OpenStack, LLC.
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,6 +14,3 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
logging.basicConfig()

View File

@ -1,4 +1,6 @@
# Copyright 2012 OpenStack LLC # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack, LLC
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -13,15 +15,16 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import unittest
import mock
from quantum.agent.linux import utils
import os import os
import logging import unittest
import mock
from quantum.agent.linux import utils
import quantum.openstack.common import log as logging
LOG = logging.getLogger('quantum.tests.database_stubs') LOG = logging.getLogger(__name__)
class RootwrapTestExec(unittest.TestCase): class RootwrapTestExec(unittest.TestCase):

View File

@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011, Cisco Systems, Inc. # Copyright 2011, Cisco Systems, Inc.
# All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # 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 # not use this file except in compliance with the License. You may obtain
@ -13,18 +14,16 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
#
# @author: Rohit Agarwalla, Cisco Systems, Inc. # @author: Rohit Agarwalla, Cisco Systems, Inc.
""" """ stubs.py provides interface methods for the database test cases """
stubs.py provides interface methods for
the database test cases
"""
import logging
from quantum.db import api as db from quantum.db import api as db
from quantum.openstack.common import log as logging
LOG = logging.getLogger('quantum.tests.database_stubs') LOG = logging.getLogger(__name__)
class QuantumDB(object): class QuantumDB(object):

View File

@ -1,6 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC. # Copyright (c) 2012 OpenStack, LLC.
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -12,9 +12,9 @@
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the spec # License for the specific language governing permissions and limitations
# under the License.
import logging
import os import os
import unittest import unittest
@ -35,8 +35,6 @@ from quantum.openstack.common.notifier import api as notifer_api
from quantum.openstack.common import uuidutils from quantum.openstack.common import uuidutils
LOG = logging.getLogger(__name__)
ROOTDIR = os.path.dirname(os.path.dirname(__file__)) ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc') ETCDIR = os.path.join(ROOTDIR, 'etc')
EXTDIR = os.path.join(ROOTDIR, 'unit/extensions') EXTDIR = os.path.join(ROOTDIR, 'unit/extensions')

View File

@ -1,25 +1,27 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack, LLC. # Copyright (c) 2012 OpenStack, LLC.
# All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License"); you may
# you may not use this file except in compliance with the License. # not use this file except in compliance with the License. You may obtain
# You may obtain a copy of the License at # a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# implied. # License for the specific language governing permissions and limitations
# See the License for the specific language governing permissions and # under the License.
# limitations under the License.
import contextlib import contextlib
import copy import copy
import datetime import datetime
import logging
import mock
import os import os
import random import random
import mock
import unittest2 import unittest2
import webob.exc import webob.exc
@ -43,8 +45,6 @@ from quantum.tests.unit.testlib_api import create_request
from quantum.wsgi import Serializer, JSONDeserializer from quantum.wsgi import Serializer, JSONDeserializer
LOG = logging.getLogger(__name__)
DB_PLUGIN_KLASS = 'quantum.db.db_base_plugin_v2.QuantumDbPluginV2' DB_PLUGIN_KLASS = 'quantum.db.db_base_plugin_v2.QuantumDbPluginV2'
ROOTDIR = os.path.dirname(os.path.dirname(__file__)) ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc') ETCDIR = os.path.join(ROOTDIR, 'etc')

View File

@ -1,5 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# Copyright (c) 2011 OpenStack, LLC.
# All Rights Reserved. # All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,7 +15,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import logging
import os import os
import unittest import unittest
@ -33,6 +33,7 @@ from quantum.common import config
from quantum.common import exceptions from quantum.common import exceptions
from quantum.db.db_base_plugin_v2 import QuantumDbPluginV2 from quantum.db.db_base_plugin_v2 import QuantumDbPluginV2
from quantum.openstack.common import jsonutils from quantum.openstack.common import jsonutils
from quantum.openstack.common import log as logging
from quantum.plugins.common import constants from quantum.plugins.common import constants
from quantum.tests.unit import BaseTest from quantum.tests.unit import BaseTest
from quantum.tests.unit.extension_stubs import ( from quantum.tests.unit.extension_stubs import (
@ -45,7 +46,7 @@ import quantum.tests.unit.extensions
from quantum import wsgi from quantum import wsgi
LOG = logging.getLogger('quantum.tests.test_extensions') LOG = logging.getLogger(__name__)
ROOTDIR = os.path.dirname(os.path.dirname(__file__)) ROOTDIR = os.path.dirname(os.path.dirname(__file__))
ETCDIR = os.path.join(ROOTDIR, 'etc') ETCDIR = os.path.join(ROOTDIR, 'etc')

View File

@ -1,6 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nicira Networks, Inc. All rights reserved. # Copyright 2012 Nicira Networks, Inc.
# All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # 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 # not use this file except in compliance with the License. You may obtain
@ -20,7 +21,6 @@
import contextlib import contextlib
import copy import copy
import itertools import itertools
import logging
import unittest2 as unittest import unittest2 as unittest
import mock import mock
@ -41,6 +41,7 @@ from quantum.db import models_v2
from quantum.extensions import l3 from quantum.extensions import l3
from quantum import manager from quantum import manager
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import log as logging
from quantum.openstack.common import uuidutils from quantum.openstack.common import uuidutils
from quantum.tests.unit import test_api_v2 from quantum.tests.unit import test_api_v2
from quantum.tests.unit import test_db_plugin from quantum.tests.unit import test_db_plugin

View File

@ -1,19 +1,20 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack, LLC. # Copyright (c) 2012 OpenStack, LLC.
# All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License"); you may
# you may not use this file except in compliance with the License. # not use this file except in compliance with the License. You may obtain
# You may obtain a copy of the License at # a copy of the License at
# #
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# implied. # License for the specific language governing permissions and limitations
# See the License for the specific language governing permissions and # under the License.
# limitations under the License.
import logging
import types import types
import unittest2 import unittest2
@ -21,6 +22,7 @@ from quantum.common import config
from quantum.common.test_lib import test_config from quantum.common.test_lib import test_config
from quantum.manager import QuantumManager from quantum.manager import QuantumManager
from quantum.openstack.common import cfg from quantum.openstack.common import cfg
from quantum.openstack.common import log as logging
from quantum.plugins.common import constants from quantum.plugins.common import constants
from quantum.plugins.services.dummy.dummy_plugin import QuantumDummyPlugin from quantum.plugins.services.dummy.dummy_plugin import QuantumDummyPlugin