Cleaned up log usage.

* Used __name__ where appropriate for log instantiation.
 * Removed unnecessary logging in tests.

Change-Id: I270eb627cd1d330f37707aaf7886a9cacd251031
This commit is contained in:
Maru Newby 2012-05-04 21:38:29 -07:00
parent c3e7d4a7c0
commit 2097ce1cf3
17 changed files with 16 additions and 60 deletions

View File

@ -23,9 +23,11 @@ from quantum import wsgi
from quantum.api import faults from quantum.api import faults
LOG = logging.getLogger(__name__)
XML_NS_V10 = 'http://openstack.org/quantum/api/v1.0' XML_NS_V10 = 'http://openstack.org/quantum/api/v1.0'
XML_NS_V11 = 'http://openstack.org/quantum/api/v1.1' XML_NS_V11 = 'http://openstack.org/quantum/api/v1.1'
LOG = logging.getLogger('quantum.api.api_common')
class OperationalStatus: class OperationalStatus:

View File

@ -20,7 +20,7 @@ from quantum.api.views import attachments as attachments_view
from quantum.common import exceptions as exception from quantum.common import exceptions as exception
LOG = logging.getLogger('quantum.api.ports') LOG = logging.getLogger(__name__)
def create_resource(plugin, version): def create_resource(plugin, version):

View File

@ -24,7 +24,7 @@ from quantum.api.views import networks as networks_view
from quantum.common import exceptions as exception from quantum.common import exceptions as exception
LOG = logging.getLogger('quantum.api.networks') LOG = logging.getLogger(__name__)
def create_resource(plugin, version): def create_resource(plugin, version):

View File

@ -21,7 +21,7 @@ from quantum.api.views import ports as ports_view
from quantum.common import exceptions as exception from quantum.common import exceptions as exception
LOG = logging.getLogger('quantum.api.ports') LOG = logging.getLogger(__name__)
def create_resource(plugin, version): def create_resource(plugin, version):

View File

@ -21,7 +21,8 @@ import webob.dec
from quantum import wsgi from quantum import wsgi
from quantum.api.views import versions as versions_view from quantum.api.views import versions as versions_view
LOG = logging.getLogger('quantum.api.versions')
LOG = logging.getLogger(__name__)
class Versions(wsgi.Application): class Versions(wsgi.Application):

View File

@ -19,7 +19,7 @@
import logging import logging
LOG = logging.getLogger('quantum.api.views.filters') LOG = logging.getLogger(__name__)
def _load_network_ports_details(network, **kwargs): def _load_network_ports_details(network, **kwargs):

View File

@ -39,7 +39,6 @@ DEFAULT_LOG_FORMAT = "%(asctime)s %(levelname)8s [%(name)s] %(message)s"
DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
FLAGS = flags.FLAGS FLAGS = flags.FLAGS
LOG = logging.getLogger('quantum.wsgi')
def parse_options(parser, cli_args=None): def parse_options(parser, cli_args=None):

View File

@ -29,10 +29,12 @@ from quantum.common import exceptions as q_exc
from quantum.db import models from quantum.db import models
LOG = logging.getLogger(__name__)
_ENGINE = None _ENGINE = None
_MAKER = None _MAKER = None
BASE = models.BASE BASE = models.BASE
LOG = logging.getLogger('quantum.db.api')
class MySQLPingListener(object): class MySQLPingListener(object):

View File

@ -32,7 +32,7 @@ from quantum.manager import QuantumManager
from quantum import wsgi from quantum import wsgi
LOG = logging.getLogger('quantum.extensions.extensions') LOG = logging.getLogger('quantum.api.extensions')
class PluginInterface(object): class PluginInterface(object):

View File

@ -32,7 +32,7 @@ from quantum.common.exceptions import ClassNotFound
from quantum.quantum_plugin_base import QuantumPluginBase from quantum.quantum_plugin_base import QuantumPluginBase
LOG = logging.getLogger('quantum.manager') LOG = logging.getLogger(__name__)
CONFIG_FILE = "plugins.ini" CONFIG_FILE = "plugins.ini"

View File

@ -32,7 +32,6 @@ from quantum.plugins.openvswitch import ovs_db
from quantum.quantum_plugin_base import QuantumPluginBase from quantum.quantum_plugin_base import QuantumPluginBase
logging.basicConfig(level=logging.WARN)
LOG = logging.getLogger("ovs_quantum_plugin") LOG = logging.getLogger("ovs_quantum_plugin")

View File

@ -16,7 +16,6 @@
# #
# @author: Dave Lapsley, Nicira Networks, Inc. # @author: Dave Lapsley, Nicira Networks, Inc.
import logging
import os import os
import unittest import unittest
@ -25,10 +24,6 @@ import mox
from quantum.plugins.openvswitch.agent import ovs_quantum_agent from quantum.plugins.openvswitch.agent import ovs_quantum_agent
LOG = logging.getLogger("quantum.plugins.openvswitch.tests.unit.test_tunnel")
LOG.setLevel(logging.INFO)
LOCAL_DIR = os.path.dirname(__file__) LOCAL_DIR = os.path.dirname(__file__)
REMOTE_IP_FILE = LOCAL_DIR + '/remote-ip-file.txt' REMOTE_IP_FILE = LOCAL_DIR + '/remote-ip-file.txt'

View File

@ -22,7 +22,7 @@ from quantum.common import exceptions as exception
from quantum import wsgi from quantum import wsgi
LOG = logging.getLogger('quantum.service') LOG = logging.getLogger(__name__)
class WsgiService(object): class WsgiService(object):

View File

@ -17,7 +17,6 @@
# @author: Salvatore Orlando, Citrix Systems # @author: Salvatore Orlando, Citrix Systems
import json import json
import logging
import unittest import unittest
from lxml import etree from lxml import etree
@ -32,9 +31,6 @@ import quantum.tests.unit._test_api as test_api
import quantum.tests.unit.testlib_api as testlib import quantum.tests.unit.testlib_api as testlib
LOG = logging.getLogger('quantum.tests.test_api')
class APITestV10(test_api.BaseAPIOperationsTest): class APITestV10(test_api.BaseAPIOperationsTest):
def assert_network(self, **kwargs): def assert_network(self, **kwargs):
@ -185,7 +181,6 @@ class APIFiltersTest(test_api.AbstractAPITest):
self.port22_id = self._create_port(self.net2_id, "ACTIVE", self.fmt) self.port22_id = self._create_port(self.net2_id, "ACTIVE", self.fmt)
def test_network_name_filter(self): def test_network_name_filter(self):
LOG.debug("test_network_name_filter - START")
flt = "name=test-1" flt = "name=test-1"
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
# Check network count: should return 1 # Check network count: should return 1
@ -197,10 +192,7 @@ class APIFiltersTest(test_api.AbstractAPITest):
# Check network count: should return 0 # Check network count: should return 0
self.assertEqual(len(network_data['networks']), 0) self.assertEqual(len(network_data['networks']), 0)
LOG.debug("test_network_name_filter - END")
def test_network_op_status_filter(self): def test_network_op_status_filter(self):
LOG.debug("test_network_op_status_filter - START")
# First filter for networks in default status # First filter for networks in default status
flt = "op-status=%s" % self.net_op_status flt = "op-status=%s" % self.net_op_status
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
@ -212,19 +204,15 @@ class APIFiltersTest(test_api.AbstractAPITest):
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
# Check network count: should return 0 # Check network count: should return 0
self.assertEqual(len(network_data['networks']), 0) self.assertEqual(len(network_data['networks']), 0)
LOG.debug("test_network_op_status_filter - END")
def test_network_port_op_status_filter(self): def test_network_port_op_status_filter(self):
LOG.debug("test_network_port_op_status_filter - START")
# First filter for networks with ports in default op status # First filter for networks with ports in default op status
flt = "port-op-status=%s" % self.port_op_status flt = "port-op-status=%s" % self.port_op_status
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
# Check network count: should return 2 # Check network count: should return 2
self.assertEqual(len(network_data['networks']), 2) self.assertEqual(len(network_data['networks']), 2)
LOG.debug("test_network_port_op_status_filter - END")
def test_network_port_state_filter(self): def test_network_port_state_filter(self):
LOG.debug("test_network_port_state_filter - START")
# First filter for networks with ports 'ACTIVE' # First filter for networks with ports 'ACTIVE'
flt = "port-state=ACTIVE" flt = "port-state=ACTIVE"
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
@ -236,10 +224,8 @@ class APIFiltersTest(test_api.AbstractAPITest):
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
# Check network count: should return 1 # Check network count: should return 1
self.assertEqual(len(network_data['networks']), 1) self.assertEqual(len(network_data['networks']), 1)
LOG.debug("test_network_port_state_filter - END")
def test_network_has_attachment_filter(self): def test_network_has_attachment_filter(self):
LOG.debug("test_network_has_attachment_filter - START")
# First filter for networks with ports 'ACTIVE' # First filter for networks with ports 'ACTIVE'
flt = "has-attachment=True" flt = "has-attachment=True"
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
@ -251,11 +237,8 @@ class APIFiltersTest(test_api.AbstractAPITest):
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
# Check network count: should return 1 # Check network count: should return 1
self.assertEqual(len(network_data['networks']), 1) self.assertEqual(len(network_data['networks']), 1)
LOG.debug("test_network_has_attachment_filter - END")
def test_network_port_filter(self): def test_network_port_filter(self):
LOG.debug("test_network_port_filter - START")
flt = "port=%s" % self.port11_id flt = "port=%s" % self.port11_id
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
# Check network count: should return 1 # Check network count: should return 1
@ -267,11 +250,8 @@ class APIFiltersTest(test_api.AbstractAPITest):
# Check network count: should return 1 # Check network count: should return 1
self.assertEqual(len(network_data['networks']), 1) self.assertEqual(len(network_data['networks']), 1)
self.assertEqual(network_data['networks'][0]['id'], self.net2_id) self.assertEqual(network_data['networks'][0]['id'], self.net2_id)
LOG.debug("test_network_port_filter - END")
def test_network_attachment_filter(self): def test_network_attachment_filter(self):
LOG.debug("test_network_attachment_filter - START")
flt = "attachment=test-1-att" flt = "attachment=test-1-att"
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
# Check network count: should return 1 # Check network count: should return 1
@ -282,10 +262,8 @@ class APIFiltersTest(test_api.AbstractAPITest):
network_data = self._do_filtered_network_list_request(flt) network_data = self._do_filtered_network_list_request(flt)
# Check network count: should return 0 # Check network count: should return 0
self.assertEqual(len(network_data['networks']), 0) self.assertEqual(len(network_data['networks']), 0)
LOG.debug("test_network_attachment_filter - END")
def test_network_multiple_filters(self): def test_network_multiple_filters(self):
LOG.debug("test_network_multiple_filters - START")
# Add some data for having more fun # Add some data for having more fun
another_net_id = self._create_network(self.fmt, name="test-1") another_net_id = self._create_network(self.fmt, name="test-1")
# Add 1 ACTIVE port # Add 1 ACTIVE port
@ -296,10 +274,8 @@ class APIFiltersTest(test_api.AbstractAPITest):
# Check network count: should return 1 # Check network count: should return 1
self.assertEqual(len(network_data['networks']), 1) self.assertEqual(len(network_data['networks']), 1)
self.assertEqual(network_data['networks'][0]['id'], self.net1_id) self.assertEqual(network_data['networks'][0]['id'], self.net1_id)
LOG.debug("test_network_multiple_filters - END")
def test_port_state_filter(self): def test_port_state_filter(self):
LOG.debug("test_port_state_filter - START")
# First filter for 'ACTIVE' ports in 1st network # First filter for 'ACTIVE' ports in 1st network
flt = "state=ACTIVE" flt = "state=ACTIVE"
port_data = self._do_filtered_port_list_request(flt, self.net1_id) port_data = self._do_filtered_port_list_request(flt, self.net1_id)
@ -310,19 +286,15 @@ class APIFiltersTest(test_api.AbstractAPITest):
port_data = self._do_filtered_port_list_request(flt, self.net2_id) port_data = self._do_filtered_port_list_request(flt, self.net2_id)
# Check port count: should return 2 # Check port count: should return 2
self.assertEqual(len(port_data['ports']), 2) self.assertEqual(len(port_data['ports']), 2)
LOG.debug("test_port_state_filter - END")
def test_port_op_status_filter(self): def test_port_op_status_filter(self):
LOG.debug("test_port_op_status_filter - START")
# First filter for 'UP' ports in 1st network # First filter for 'UP' ports in 1st network
flt = "op-status=%s" % self.port_op_status flt = "op-status=%s" % self.port_op_status
port_data = self._do_filtered_port_list_request(flt, self.net1_id) port_data = self._do_filtered_port_list_request(flt, self.net1_id)
# Check port count: should return 2 # Check port count: should return 2
self.assertEqual(len(port_data['ports']), 2) self.assertEqual(len(port_data['ports']), 2)
LOG.debug("test_port_op_status_filter - END")
def test_port_has_attachment_filter(self): def test_port_has_attachment_filter(self):
LOG.debug("test_port_has_attachment_filter - START")
# First search for ports with attachments in 1st network # First search for ports with attachments in 1st network
flt = "has-attachment=True" flt = "has-attachment=True"
port_data = self._do_filtered_port_list_request(flt, self.net1_id) port_data = self._do_filtered_port_list_request(flt, self.net1_id)
@ -335,10 +307,8 @@ class APIFiltersTest(test_api.AbstractAPITest):
port_data = self._do_filtered_port_list_request(flt, self.net2_id) port_data = self._do_filtered_port_list_request(flt, self.net2_id)
# Check port count: should return 2 # Check port count: should return 2
self.assertEqual(len(port_data['ports']), 2) self.assertEqual(len(port_data['ports']), 2)
LOG.debug("test_port_has_attachment_filter - END")
def test_port_attachment_filter(self): def test_port_attachment_filter(self):
LOG.debug("test_port_attachment_filter - START")
# First search for ports with attachments in 1st network # First search for ports with attachments in 1st network
flt = "attachment=test-1-att" flt = "attachment=test-1-att"
port_data = self._do_filtered_port_list_request(flt, self.net1_id) port_data = self._do_filtered_port_list_request(flt, self.net1_id)
@ -351,10 +321,8 @@ class APIFiltersTest(test_api.AbstractAPITest):
port_data = self._do_filtered_port_list_request(flt, self.net2_id) port_data = self._do_filtered_port_list_request(flt, self.net2_id)
# Check port count: should return 0 # Check port count: should return 0
self.assertEqual(len(port_data['ports']), 0) self.assertEqual(len(port_data['ports']), 0)
LOG.debug("test_port_has_attachment_filter - END")
def test_port_multiple_filters(self): def test_port_multiple_filters(self):
LOG.debug("test_port_multiple_filters - START")
flt = "op-status=%s&state=DOWN" % self.port_op_status flt = "op-status=%s&state=DOWN" % self.port_op_status
port_data = self._do_filtered_port_list_request(flt, self.net1_id) port_data = self._do_filtered_port_list_request(flt, self.net1_id)
# Check port count: should return 1 # Check port count: should return 1
@ -371,7 +339,6 @@ class APIFiltersTest(test_api.AbstractAPITest):
port_data = self._do_filtered_port_list_request(flt, self.net2_id) port_data = self._do_filtered_port_list_request(flt, self.net2_id)
# Check port count: should return 2 # Check port count: should return 2
self.assertEqual(len(port_data['ports']), 2) self.assertEqual(len(port_data['ports']), 2)
LOG.debug("test_port_multiple_filters - END")
class APIRootTest(unittest.TestCase): class APIRootTest(unittest.TestCase):

View File

@ -20,16 +20,12 @@ test_database.py is an independent test suite
that tests the database api method calls that tests the database api method calls
""" """
import logging
import unittest import unittest
from quantum.db import api as db from quantum.db import api as db
from quantum.tests.unit import database_stubs as db_stubs from quantum.tests.unit import database_stubs as db_stubs
LOG = logging.getLogger('quantum.tests.test_database')
class QuantumDBTest(unittest.TestCase): class QuantumDBTest(unittest.TestCase):
"""Class consisting of Quantum DB unit tests""" """Class consisting of Quantum DB unit tests"""
def setUp(self): def setUp(self):
@ -37,7 +33,6 @@ class QuantumDBTest(unittest.TestCase):
db.configure_db({'sql_connection': 'sqlite:///:memory:'}) db.configure_db({'sql_connection': 'sqlite:///:memory:'})
self.dbtest = db_stubs.QuantumDB() self.dbtest = db_stubs.QuantumDB()
self.tenant_id = "t1" self.tenant_id = "t1"
LOG.debug("Setup")
def tearDown(self): def tearDown(self):
"""Tear Down""" """Tear Down"""

View File

@ -15,7 +15,6 @@
# under the License. # under the License.
import json import json
import logging
import os import os
import sys import sys
import unittest import unittest
@ -46,9 +45,6 @@ import quantum.tests.unit.extensions
from quantum import wsgi from quantum import wsgi
LOG = logging.getLogger('test_extensions')
test_conf_file = config.find_config_file({}, None, "quantum.conf.test") test_conf_file = config.find_config_file({}, None, "quantum.conf.test")
extensions_path = ':'.join(quantum.tests.unit.extensions.__path__) extensions_path = ':'.join(quantum.tests.unit.extensions.__path__)

View File

@ -35,7 +35,7 @@ from quantum.common import exceptions as exception
from quantum.common import utils from quantum.common import utils
LOG = logging.getLogger('quantum.common.wsgi') LOG = logging.getLogger(__name__)
class WritableLogger(object): class WritableLogger(object):