diff --git a/src/python/oftest/testutils.py b/src/python/oftest/testutils.py
index 0d2dd09..2fdc9ce 100644
--- a/src/python/oftest/testutils.py
+++ b/src/python/oftest/testutils.py
@@ -30,25 +30,23 @@
 
 MINSIZE = 0
 
-def clear_switch(parent, port_list, logger):
+def clear_switch(parent, port_list):
     """
     Clear the switch configuration
 
     @param parent Object implementing controller and assert equal
-    @param logger Logging object
     """
     for port in port_list:
-        clear_port_config(parent, port, logger)
-    delete_all_flows(parent.controller, logger)
+        clear_port_config(parent, port)
+    delete_all_flows(parent.controller)
 
-def delete_all_flows(ctrl, logger):
+def delete_all_flows(ctrl):
     """
     Delete all flows on the switch
     @param ctrl The controller object for the test
-    @param logger Logging object
     """
 
-    logger.info("Deleting all flows")
+    logging.info("Deleting all flows")
     msg = message.flow_mod()
     msg.match.wildcards = ofp.OFPFW_ALL
     msg.out_port = ofp.OFPP_NONE
@@ -56,15 +54,14 @@
     msg.buffer_id = 0xffffffff
     return ctrl.message_send(msg)
 
-def clear_port_config(parent, port, logger):
+def clear_port_config(parent, port):
     """
     Clear the port configuration (currently only no flood setting)
 
     @param parent Object implementing controller and assert equal
-    @param logger Logging object
     """
     rv = port_config_set(parent.controller, port,
-                         0, ofp.OFPPC_NO_FLOOD, logger)
+                         0, ofp.OFPPC_NO_FLOOD)
     self.assertEqual(rv, 0, "Failed to reset port config")
 
 def required_wildcards(parent):
@@ -203,7 +200,7 @@
         return -1
     return 0
 
-def port_config_get(controller, port_no, logger):
+def port_config_get(controller, port_no):
     """
     Get a port's configuration
 
@@ -215,31 +212,31 @@
     """
     request = message.features_request()
     reply, pkt = controller.transact(request)
-    logger.debug(reply.show())
+    logging.debug(reply.show())
     if reply is None:
-        logger.warn("Get feature request failed")
+        logging.warn("Get feature request failed")
         return None, None, None
     for idx in range(len(reply.ports)):
         if reply.ports[idx].port_no == port_no:
             return (reply.ports[idx].hw_addr, reply.ports[idx].config,
                     reply.ports[idx].advertised)
     
-    logger.warn("Did not find port number for port config")
+    logging.warn("Did not find port number for port config")
     return None, None, None
 
-def port_config_set(controller, port_no, config, mask, logger):
+def port_config_set(controller, port_no, config, mask):
     """
     Set the port configuration according the given parameters
 
     Gets the switch feature configuration and updates one port's
     configuration value according to config and mask
     """
-    logger.info("Setting port " + str(port_no) + " to config " + str(config))
+    logging.info("Setting port " + str(port_no) + " to config " + str(config))
     request = message.features_request()
     reply, pkt = controller.transact(request)
     if reply is None:
         return -1
-    logger.debug(reply.show())
+    logging.debug(reply.show())
     for idx in range(len(reply.ports)):
         if reply.ports[idx].port_no == port_no:
             break
@@ -254,8 +251,7 @@
     rv = controller.message_send(mod)
     return rv
 
-def receive_pkt_check(dp, pkt, yes_ports, no_ports, assert_if, logger,
-                      config):
+def receive_pkt_check(dp, pkt, yes_ports, no_ports, assert_if, config):
     """
     Check for proper receive packets across all ports
     @param dp The dataplane object
@@ -269,21 +265,21 @@
         exp_pkt_arg = pkt
 
     for ofport in yes_ports:
-        logger.debug("Checking for pkt on port " + str(ofport))
+        logging.debug("Checking for pkt on port " + str(ofport))
         (rcv_port, rcv_pkt, pkt_time) = dp.poll(
             port_number=ofport, exp_pkt=exp_pkt_arg)
         assert_if.assertTrue(rcv_pkt is not None, 
                              "Did not receive pkt on " + str(ofport))
         if not dataplane.match_exp_pkt(pkt, rcv_pkt):
-            logger.debug("Sent %s" % format_packet(pkt))
-            logger.debug("Resp %s" % format_packet(rcv_pkt))
+            logging.debug("Sent %s" % format_packet(pkt))
+            logging.debug("Resp %s" % format_packet(rcv_pkt))
         assert_if.assertTrue(dataplane.match_exp_pkt(pkt, rcv_pkt),
                              "Response packet does not match send packet " +
                              "on port " + str(ofport))
     if len(no_ports) > 0:
         time.sleep(1)
     for ofport in no_ports:
-        logger.debug("Negative check for pkt on port " + str(ofport))
+        logging.debug("Negative check for pkt on port " + str(ofport))
         (rcv_port, rcv_pkt, pkt_time) = dp.poll(
             port_number=ofport, timeout=1, exp_pkt=exp_pkt_arg)
         assert_if.assertTrue(rcv_pkt is None, 
@@ -315,19 +311,19 @@
             port_number=check_port, exp_pkt=exp_pkt_arg)
 
         if rcv_pkt is None:
-            parent.logger.error("ERROR: No packet received from " + 
+            logging.error("ERROR: No packet received from " + 
                                 str(check_port))
 
         parent.assertTrue(rcv_pkt is not None,
                           "Did not receive packet port " + str(check_port))
-        parent.logger.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
+        logging.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
                             str(rcv_port))
 
         if str(exp_pkt) != str(rcv_pkt):
-            parent.logger.error("ERROR: Packet match failed.")
-            parent.logger.debug("Expected len " + str(len(exp_pkt)) + ": "
+            logging.error("ERROR: Packet match failed.")
+            logging.debug("Expected len " + str(len(exp_pkt)) + ": "
                                 + str(exp_pkt).encode('hex'))
-            parent.logger.debug("Received len " + str(len(rcv_pkt)) + ": "
+            logging.debug("Received len " + str(len(rcv_pkt)) + ": "
                                 + str(rcv_pkt).encode('hex'))
         parent.assertEqual(str(exp_pkt), str(rcv_pkt),
                            "Packet match error on port " + str(check_port))
@@ -470,7 +466,7 @@
 
     if action_list is not None:
         for act in action_list:
-            parent.logger.debug("Adding action " + act.show())
+            logging.debug("Adding action " + act.show())
             rv = request.actions.add(act)
             parent.assertTrue(rv, "Could not add action" + act.show())
 
@@ -492,7 +488,7 @@
             parent.assertTrue(rv, "Could not add output action " + 
                               str(egr_port))
 
-    parent.logger.debug(request.show())
+    logging.debug(request.show())
 
     return request
 
@@ -510,12 +506,12 @@
         clear_table = clear_table_override
 
     if clear_table: 
-        parent.logger.debug("Clear flow table")
-        rc = delete_all_flows(parent.controller, parent.logger)
+        logging.debug("Clear flow table")
+        rc = delete_all_flows(parent.controller)
         parent.assertEqual(rc, 0, "Failed to delete all flows")
         parent.assertEqual(do_barrier(parent.controller), 0, "Barrier failed")
 
-    parent.logger.debug("Insert flow")
+    logging.debug("Insert flow")
     rv = parent.controller.message_send(request)
     parent.assertTrue(rv != -1, "Error installing flow mod")
     parent.assertEqual(do_barrier(parent.controller), 0, "Barrier failed")
@@ -533,9 +529,9 @@
 
     if wildcards is None:
         wildcards = required_wildcards(parent)
-    parent.logger.info("Pkt match test: " + str(ing_port) + " to " + 
+    logging.info("Pkt match test: " + str(ing_port) + " to " + 
                        str(egr_ports))
-    parent.logger.debug("  WC: " + hex(wildcards) + " vlan: " + str(dl_vlan) +
+    logging.debug("  WC: " + hex(wildcards) + " vlan: " + str(dl_vlan) +
                     " expire: " + str(check_expire))
     if pkt is None:
         pkt = simple_tcp_packet(dl_vlan_enable=(dl_vlan >= 0), dl_vlan=dl_vlan)
@@ -546,7 +542,7 @@
 
     flow_msg_install(parent, request)
 
-    parent.logger.debug("Send packet: " + str(ing_port) + " to " + 
+    logging.debug("Send packet: " + str(ing_port) + " to " + 
                         str(egr_ports))
     parent.dataplane.send(ing_port, str(pkt))
 
@@ -561,7 +557,7 @@
 def get_egr_list(parent, of_ports, how_many, exclude_list=[]):
     """
     Generate a list of ports avoiding those in the exclude list
-    @param parent Supplies logger
+    @param parent Supplies logging
     @param of_ports List of OF port numbers
     @param how_many Number of ports to be added to the list
     @param exclude_list List of ports not to be used
@@ -579,7 +575,7 @@
             count += 1
             if count >= how_many:
                 return egr_ports
-    parent.logger.debug("Could not generate enough egress ports for test")
+    logging.debug("Could not generate enough egress ports for test")
     return []
     
 def flow_match_test(parent, port_map, wildcards=None, dl_vlan=-1, pkt=None, 
@@ -590,7 +586,7 @@
 
     @param max_test If > 0 no more than this number of tests are executed.
     @param parent Must implement controller, dataplane, assertTrue, assertEqual
-    and logger
+    and logging
     @param pkt If not None, use this packet for ingress
     @param wildcards For flow match entry
     @param dl_vlan If not -1, and pkt is None, create a pkt w/ VLAN tag
@@ -625,7 +621,7 @@
                                   check_expire=check_expire)
         test_count += 1
         if (max_test > 0) and (test_count > max_test):
-            parent.logger.info("Ran " + str(test_count) + " tests; exiting")
+            logging.info("Ran " + str(test_count) + " tests; exiting")
             return
 
 def test_param_get(config, key, default=None):
@@ -711,7 +707,7 @@
     """
     Set up the ingress and expected packet and action list for a test
 
-    @param parent Must implement, assertTrue, config hash and logger
+    @param parent Must implement, assertTrue, and config hash
     @param start_field_values Field values to use for ingress packet (optional)
     @param mod_field_values Field values to use for modified packet (optional)
     @param mod_fields The list of fields to be modified by the switch in the test.
@@ -816,12 +812,12 @@
     Print out a 'skipped' message to stderr
 
     @param s The string to print out to the log file
-    @param parent Must implement config and logger objects
+    @param parent Must implement config object
     """
     global skipped_test_count
 
     skipped_test_count += 1
-    parent.logger.info("Skipping: " + s)
+    logging.info("Skipping: " + s)
     if parent.config["dbg_level"] < logging.WARNING:
         sys.stderr.write("(skipped) ")
     else:
diff --git a/tests/actions.py b/tests/actions.py
index cd54093..d0dab71 100644
--- a/tests/actions.py
+++ b/tests/actions.py
@@ -25,7 +25,6 @@
 from FuncUtils import *
 
 ac_port_map = None
-ac_logger = None
 ac_config = None
 of_ports = None
 
@@ -33,12 +32,9 @@
     basic.test_set_init(config)
     
     global ac_port_map
-    global ac_logger
     global ac_config
     global of_ports
 
-    ac_logger = logging.getLogger("Running Actions test-suite")
-    ac_logger.info("Initializing test set")
     ac_port_map = config["port_map"]
     ac_config = config
     
@@ -53,19 +49,19 @@
 
     def runTest(self):
         
-        ac_logger.info("Running No_Action test")
+        logging.info("Running No_Action test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         
-        ac_logger.info("Install a flow without action")
-        ac_logger.info("Send packets matching that flow")
-        ac_logger.info("Expecting switch to drop all packets")
+        logging.info("Install a flow without action")
+        logging.info("Send packets matching that flow")
+        logging.info("Expecting switch to drop all packets")
 
         # Insert a flow wildcard all without any action 
         pkt = simple_tcp_packet()
@@ -105,10 +101,10 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Announcement test")
+        logging.info("Running Announcement test")
 
-        ac_logger.info("Sending Features_Request")
-        ac_logger.info("Expecting Features Reply with supported actions")
+        logging.info("Sending Features_Request")
+        logging.info("Expecting Features Reply with supported actions")
 
         # Sending Features_Request
         request = message.features_request()
@@ -142,7 +138,7 @@
         if(reply.actions &1<<ofp.OFPAT_ENQUEUE):
             supported_actions.append('OFPAT_ENQUEUE')
         
-        ac_logger.info(supported_actions)
+        logging.info(supported_actions)
         
 
 class ForwardAll(basic.SimpleDataPlane):
@@ -152,19 +148,19 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Forward_All test")
+        logging.info("Running Forward_All test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         
-        ac_logger.info("Insert a flow with output action port OFPP_ALL")
-        ac_logger.info("Send packet matching the flow")
-        ac_logger.info("Expecting packet on all dataplane ports except ingress_port")
+        logging.info("Insert a flow with output action port OFPP_ALL")
+        logging.info("Send packet matching the flow")
+        logging.info("Expecting packet on all dataplane ports except ingress_port")
         
         #Create a packet
         pkt = simple_tcp_packet()
@@ -172,7 +168,7 @@
         act = action.action_output()
 
         #Delete all flows 
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         ingress_port=of_ports[0]
         match.in_port = ingress_port
@@ -184,19 +180,19 @@
         act.port = ofp.OFPP_ALL
         request.actions.add(act)
         
-        ac_logger.info("Inserting flow")
+        logging.info("Inserting flow")
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
         #Send Packet matching the flow
-        ac_logger.info("Sending packet to dp port " + str(ingress_port))
+        logging.info("Sending packet to dp port " + str(ingress_port))
         self.dataplane.send(ingress_port, str(pkt))
 
         #Verifying packets recieved on expected dataplane ports
         yes_ports = set(of_ports).difference([ingress_port])
         receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
-                      self, ac_logger, ac_config)
+                      self, ac_config)
 
 
 class ForwardController(basic.SimpleDataPlane):
@@ -206,19 +202,19 @@
 
     def runTest(self):
         
-        ac_logger.info("Running Forward_Controller test")
+        logging.info("Running Forward_Controller test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         
-        ac_logger.info("Insert a flow with output action port OFPP_CONTROLLER")
-        ac_logger.info("Send packet matching the flow")
-        ac_logger.info("Expecting packet on the control plane")
+        logging.info("Insert a flow with output action port OFPP_CONTROLLER")
+        logging.info("Send packet matching the flow")
+        logging.info("Expecting packet on the control plane")
         
         #Create packet
         pkt = simple_tcp_packet()
@@ -227,7 +223,7 @@
 
         for ingress_port in of_ports:
             #Delete all flows 
-            rv = delete_all_flows(self.controller, ac_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
             match.in_port = ingress_port
@@ -238,13 +234,13 @@
             act.port = ofp.OFPP_CONTROLLER
             request.actions.add(act)
 
-            ac_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
             
             #Send packet matching the flow
-            ac_logger.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
 
             #Verifying packet recieved on the control plane port
@@ -261,19 +257,19 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Forward_Local test")
+        logging.info("Running Forward_Local test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         
-        ac_logger.info("Insert a flow with output action port OFPP_LOCAL")
-        ac_logger.info("Send packet matching the flow")
-        ac_logger.info("Expecting packet in the local networking stack of switch")
+        logging.info("Insert a flow with output action port OFPP_LOCAL")
+        logging.info("Send packet matching the flow")
+        logging.info("Expecting packet in the local networking stack of switch")
         
         #Clear switch state
         pkt = simple_tcp_packet()
@@ -282,7 +278,7 @@
 
         for ingress_port in of_ports:
             #Delete the flows
-            rv = delete_all_flows(self.controller, ac_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
             match.in_port = ingress_port
@@ -292,13 +288,13 @@
             act.port = ofp.OFPP_LOCAL
             request.actions.add(act)
 
-            ac_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
             #Send packet matching the flow
-            ac_logger.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
 
             #TBD: Verification of packets being recieved.
@@ -313,18 +309,18 @@
     
     def runTest(self):
 
-        ac_logger.info("Running Forward_Flood test")
+        logging.info("Running Forward_Flood test")
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         
-        ac_logger.info("Insert a flow with output action port OFPP_FORWARD")
-        ac_logger.info("Send packet matching the flow")
-        ac_logger.info("Expecting packet on all the ports except the input port")
+        logging.info("Insert a flow with output action port OFPP_FORWARD")
+        logging.info("Send packet matching the flow")
+        logging.info("Expecting packet on all the ports except the input port")
         
         #Create a packet
         pkt = simple_tcp_packet()
@@ -332,7 +328,7 @@
         act = action.action_output()
 
         #Delete all flows 
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         ingress_port=of_ports[0]
         match.in_port = ingress_port
@@ -344,19 +340,19 @@
         act.port = ofp.OFPP_FLOOD
         request.actions.add(act)
         
-        ac_logger.info("Inserting flow")
+        logging.info("Inserting flow")
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
         #Send Packet matching the flow
-        ac_logger.info("Sending packet to dp port " + str(ingress_port))
+        logging.info("Sending packet to dp port " + str(ingress_port))
         self.dataplane.send(ingress_port, str(pkt))
 
         #Verifying packets recieved on expected dataplane ports
         yes_ports = set(of_ports).difference([ingress_port])
         receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
-                      self, ac_logger, ac_config)
+                      self, ac_config)
 
 class ForwardInport(basic.SimpleDataPlane):
     
@@ -365,19 +361,19 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Forward_Inport test")
+        logging.info("Running Forward_Inport test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         
-        ac_logger.info("Insert a flow with output action port OFPP_INPORT")
-        ac_logger.info("Send packet matching the flow")
-        ac_logger.info("Expecting packet on the input port")
+        logging.info("Insert a flow with output action port OFPP_INPORT")
+        logging.info("Send packet matching the flow")
+        logging.info("Expecting packet on the input port")
         
         #Create a packet
         pkt = simple_tcp_packet()
@@ -385,7 +381,7 @@
         act = action.action_output()
 
         #Delete the flows
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         ingress_port=of_ports[0]
         match.in_port = ingress_port
@@ -396,19 +392,19 @@
         act.port = ofp.OFPP_IN_PORT
             
         request.actions.add(act)
-        ac_logger.info("Inserting flow")
+        logging.info("Inserting flow")
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
         #Send packet matching the flow
-        ac_logger.info("Sending packet to dp port " + str(ingress_port))
+        logging.info("Sending packet to dp port " + str(ingress_port))
         self.dataplane.send(ingress_port, str(pkt))
         yes_ports = [ingress_port]
 
         #Verfying packet recieved on expected dataplane ports
         receive_pkt_check(self.dataplane, pkt, yes_ports,set(of_ports).difference([ingress_port]),
-                            self, ac_logger, ac_config)      
+                            self, ac_config)      
 
 class ForwardTable(basic.SimpleDataPlane):
    
@@ -418,19 +414,19 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Forward_Table test")
+        logging.info("Running Forward_Table test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
         
-        ac_logger.info("Insert a flow F with output action port set to some egress_port")
-        ac_logger.info("Send packet out message (matching flow F) with action.port = OFP.TABLE")
-        ac_logger.info("Expecting packet on the egress_port")
+        logging.info("Insert a flow F with output action port set to some egress_port")
+        logging.info("Send packet out message (matching flow F) with action.port = OFP.TABLE")
+        logging.info("Expecting packet on the egress_port")
         
         #Insert a all wildcarded flow
         (pkt,match) = Wildcard_All(self,of_ports)
@@ -457,19 +453,19 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Add_vlan_tag test")
+        logging.info("Running Add_vlan_tag test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- set vlan id, if not skip the test")
-        ac_logger.info("Insert a flow with set vid action")
-        ac_logger.info("Send packet matching the flow , verify recieved packet has vid set")
+        logging.info("Verify if switch supports the action -- set vlan id, if not skip the test")
+        logging.info("Insert a flow with set vid action")
+        logging.info("Send packet matching the flow , verify recieved packet has vid set")
         
         #Verify set_vlan_id is a supported action
         sup_acts = sw_supported_actions(self)
@@ -497,19 +493,19 @@
     
     def runTest(self):
 
-        ac_logger.info("Running Modify_Vlan_Tag test")
+        logging.info("Running Modify_Vlan_Tag test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- modify vlan id, if not skip the test")
-        ac_logger.info("Insert a flow with action --set vid ")
-        ac_logger.info("Send tagged packet matching the flow , verify recieved packet has vid rewritten")
+        logging.info("Verify if switch supports the action -- modify vlan id, if not skip the test")
+        logging.info("Insert a flow with action --set vid ")
+        logging.info("Send tagged packet matching the flow , verify recieved packet has vid rewritten")
         
         #Verify set_vlan_id is a supported action
         sup_acts = sw_supported_actions(self)
@@ -535,19 +531,19 @@
     
     def runTest(self):
 
-        ac_logger.info("Running vlan_Prio_1 test")
+        logging.info("Running vlan_Prio_1 test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- set vlan priority, if not skip the test")
-        ac_logger.info("Insert a flow with action -- set vlan priority ")
-        ac_logger.info("Send untagged packet matching the flow , verify recieved packet has specified VLAN priority and has vid set tO 0 ")
+        logging.info("Verify if switch supports the action -- set vlan priority, if not skip the test")
+        logging.info("Insert a flow with action -- set vlan priority ")
+        logging.info("Send untagged packet matching the flow , verify recieved packet has specified VLAN priority and has vid set tO 0 ")
         
         #Verify set_vlan_priority is a supported action
         sup_acts = sw_supported_actions(self)
@@ -574,19 +570,19 @@
     
     def runTest(self):
         
-        ac_logger.info("Running Vlan_Prio_2 test")
+        logging.info("Running Vlan_Prio_2 test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- set vlan priority, if not skip the test")
-        ac_logger.info("Insert a flow with action -- set vlan priority ")
-        ac_logger.info("Send tagged packet matching the flow, verify recieved packet has vlan priority rewritten")
+        logging.info("Verify if switch supports the action -- set vlan priority, if not skip the test")
+        logging.info("Insert a flow with action -- set vlan priority ")
+        logging.info("Send tagged packet matching the flow, verify recieved packet has vlan priority rewritten")
         
         #Verify set_vlan_priority is a supported action
         sup_acts = sw_supported_actions(self,"true")
@@ -614,19 +610,19 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Modify_L2_Src test")
+        logging.info("Running Modify_L2_Src test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- modify_l2_src, if not skip the test")
-        ac_logger.info("Insert a flow with action -- set etherent src address")
-        ac_logger.info("Send packet matching the flow, verify recieved packet src address rewritten ")
+        logging.info("Verify if switch supports the action -- modify_l2_src, if not skip the test")
+        logging.info("Insert a flow with action -- set etherent src address")
+        logging.info("Send packet matching the flow, verify recieved packet src address rewritten ")
 
         #Verify set_dl_src is a supported action
         sup_acts = sw_supported_actions(self,use_cache="true")
@@ -649,19 +645,19 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Modify_L2_Dst test")
+        logging.info("Running Modify_L2_Dst test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- modify_l2_dst, if not skip the test")
-        ac_logger.info("Insert a flow with action -- set etherent dst address ")
-        ac_logger.info("Send packet matching the flow, verify recieved packet dst address rewritten ")
+        logging.info("Verify if switch supports the action -- modify_l2_dst, if not skip the test")
+        logging.info("Insert a flow with action -- set etherent dst address ")
+        logging.info("Send packet matching the flow, verify recieved packet dst address rewritten ")
 
         #Verify set_dl_dst is a supported action
         sup_acts = sw_supported_actions(self)
@@ -683,19 +679,19 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Modify_L3_Src test")
+        logging.info("Running Modify_L3_Src test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- modify_l3_src, if not skip the test")
-        ac_logger.info("Insert a flow with action -- set network src address ")
-        ac_logger.info("Send packet matching the flow, verify recieved packet network src address rewritten ")
+        logging.info("Verify if switch supports the action -- modify_l3_src, if not skip the test")
+        logging.info("Insert a flow with action -- set network src address ")
+        logging.info("Send packet matching the flow, verify recieved packet network src address rewritten ")
         
         #Verify set_nw_src is a supported action
         sup_acts = sw_supported_actions(self)
@@ -717,19 +713,19 @@
     
     def runTest(self):
 
-        ac_logger.info("Running Modify_L3_Dst test")
+        logging.info("Running Modify_L3_Dst test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- modify_l3_dst, if not skip the test")
-        ac_logger.info("Insert a flow with action -- set network dst address ")
-        ac_logger.info("Send packet matching the flow, verify recieved packet network dst address rewritten ")
+        logging.info("Verify if switch supports the action -- modify_l3_dst, if not skip the test")
+        logging.info("Insert a flow with action -- set network dst address ")
+        logging.info("Send packet matching the flow, verify recieved packet network dst address rewritten ")
 
         #Verify set_nw_dst is a supported action
         sup_acts = sw_supported_actions(self,use_cache="true")
@@ -752,19 +748,19 @@
     
     def runTest(self):
 
-        ac_logger.info("Running Modify_L4_Src test")
+        logging.info("Running Modify_L4_Src test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- modify_l4_src, if not skip the test")
-        ac_logger.info("Insert a flow with action -- set src tcp port")
-        ac_logger.info("Send packet matching the flow, verify recieved packet src tcp port is rewritten ")
+        logging.info("Verify if switch supports the action -- modify_l4_src, if not skip the test")
+        logging.info("Insert a flow with action -- set src tcp port")
+        logging.info("Send packet matching the flow, verify recieved packet src tcp port is rewritten ")
         
         #Verify set_tp_src is a supported action
         sup_acts = sw_supported_actions(self,use_cache="true")
@@ -786,19 +782,19 @@
 
     def runTest(self):
 
-        ac_logger.info("Running Modify_L4_Dst test")
+        logging.info("Running Modify_L4_Dst test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- modify_l4_dst, if not skip the test")
-        ac_logger.info("Insert a flow with action -- set dst tcp port")
-        ac_logger.info("Send packet matching the flow, verify recieved packet dst tcp port is rewritten ")
+        logging.info("Verify if switch supports the action -- modify_l4_dst, if not skip the test")
+        logging.info("Insert a flow with action -- set dst tcp port")
+        logging.info("Send packet matching the flow, verify recieved packet dst tcp port is rewritten ")
        
         #Verify set_tp_dst is a supported action
         sup_acts = sw_supported_actions(self,use_cache="true")
@@ -820,19 +816,19 @@
    
     def runTest(self):
 
-        ac_logger.info("Running Modify_Tos test")
+        logging.info("Running Modify_Tos test")
 
         of_ports = ac_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rv = delete_all_flows(self.controller, ac_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
-        ac_logger.info("Verify if switch supports the action -- modify_tos, if not skip the test")
-        ac_logger.info("Insert a flow with action -- set type of service ")
-        ac_logger.info("Send packet matching the flow, verify recieved packet has TOS rewritten ")
+        logging.info("Verify if switch supports the action -- modify_tos, if not skip the test")
+        logging.info("Insert a flow with action -- set type of service ")
+        logging.info("Send packet matching the flow, verify recieved packet has TOS rewritten ")
        
         #Verify set_tos is a supported action
         sup_acts = sw_supported_actions(self,use_cache="true")
diff --git a/tests/basic.py b/tests/basic.py
index 53947b4..0112734 100644
--- a/tests/basic.py
+++ b/tests/basic.py
@@ -36,8 +36,6 @@
 #@var basic_port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 basic_port_map = None
-#@var basic_logger Local logger object
-basic_logger = None
 #@var basic_config Local copy of global configuration data
 basic_config = None
 
@@ -53,11 +51,8 @@
     """
 
     global basic_port_map
-    global basic_logger
     global basic_config
 
-    basic_logger = logging.getLogger("basic")
-    basic_logger.info("Initializing test set")
     basic_port_map = config["port_map"]
     basic_config = config
 
@@ -67,22 +62,21 @@
     """
 
     def sig_handler(self, v1, v2):
-        basic_logger.critical("Received interrupt signal; exiting")
+        logging.critical("Received interrupt signal; exiting")
         print "Received interrupt signal; exiting"
         self.clean_shutdown = False
         self.tearDown()
         raise KeyboardInterrupt
 
     def setUp(self):
-        self.logger = basic_logger
         self.config = basic_config
         #@todo Test cases shouldn't monkey with signals; move SIGINT handler
         # to top-level oft
         try:
            signal.signal(signal.SIGINT, self.sig_handler)
         except ValueError, e:
-           basic_logger.info("Could not set SIGINT handler: %s" % e)
-        basic_logger.info("** START TEST CASE " + str(self))
+           logging.info("Could not set SIGINT handler: %s" % e)
+        logging.info("** START TEST CASE " + str(self))
         self.controller = controller.Controller(
             host=basic_config["controller_host"],
             port=basic_config["controller_port"])
@@ -100,13 +94,13 @@
             raise Exception("Controller startup failed")
         if self.controller.switch_addr is None: 
             raise Exception("Controller startup failed (no switch addr)")
-        basic_logger.info("Connected " + str(self.controller.switch_addr))
+        logging.info("Connected " + str(self.controller.switch_addr))
         request = message.features_request()
         reply, pkt = self.controller.transact(request)
         self.assertTrue(reply is not None,
                         "Did not complete features_request for handshake")
         self.supported_actions = reply.actions
-        basic_logger.info("Supported actions: " + hex(self.supported_actions))
+        logging.info("Supported actions: " + hex(self.supported_actions))
 
     def inheritSetup(self, parent):
         """
@@ -123,15 +117,14 @@
         the state after the sub_test is run must be taken into account
         by subsequent operations.
         """
-        self.logger = parent.logger
         self.config = parent.config
-        basic_logger.info("** Setup " + str(self) + " inheriting from "
+        logging.info("** Setup " + str(self) + " inheriting from "
                           + str(parent))
         self.controller = parent.controller
         self.supported_actions = parent.supported_actions
         
     def tearDown(self):
-        basic_logger.info("** END TEST CASE " + str(self))
+        logging.info("** END TEST CASE " + str(self))
         self.controller.shutdown()
         #@todo Review if join should be done on clean_shutdown
         if self.clean_shutdown:
@@ -139,13 +132,13 @@
 
     def runTest(self):
         # Just a simple sanity check as illustration
-        basic_logger.info("Running simple proto test")
+        logging.info("Running simple proto test")
         self.assertTrue(self.controller.switch_socket is not None,
                         str(self) + 'No connection to switch')
 
     def assertTrue(self, cond, msg):
         if not cond:
-            basic_logger.error("** FAILED ASSERTION: " + msg)
+            logging.error("** FAILED ASSERTION: " + msg)
         unittest.TestCase.assertTrue(self, cond, msg)
 
 test_prio["SimpleProtocol"] = 1
@@ -170,11 +163,11 @@
         self.dataplane = parent.dataplane
 
     def tearDown(self):
-        basic_logger.info("Teardown for simple dataplane test")
+        logging.info("Teardown for simple dataplane test")
         SimpleProtocol.tearDown(self)
         if hasattr(self, 'dataplane'):
             self.dataplane.kill(join_threads=self.clean_shutdown)
-        basic_logger.info("Teardown done")
+        logging.info("Teardown done")
 
     def runTest(self):
         self.assertTrue(self.controller.switch_socket is not None,
@@ -188,7 +181,7 @@
     """
 
     def sig_handler(self, v1, v2):
-        basic_logger.critical("Received interrupt signal; exiting")
+        logging.critical("Received interrupt signal; exiting")
         print "Received interrupt signal; exiting"
         self.clean_shutdown = False
         self.tearDown()
@@ -196,26 +189,25 @@
 
     def setUp(self):
         self.clean_shutdown = True
-        self.logger = basic_logger
         self.config = basic_config
         #@todo Test cases shouldn't monkey with signals; move SIGINT handler
         # to top-level oft
         try:
            signal.signal(signal.SIGINT, self.sig_handler)
         except ValueError, e:
-           basic_logger.info("Could not set SIGINT handler: %s" % e)
-        basic_logger.info("** START DataPlaneOnly CASE " + str(self))
+           logging.info("Could not set SIGINT handler: %s" % e)
+        logging.info("** START DataPlaneOnly CASE " + str(self))
         self.dataplane = dataplane.DataPlane(self.config)
         for of_port, ifname in basic_port_map.items():
             self.dataplane.port_add(ifname, of_port)
 
     def tearDown(self):
-        basic_logger.info("Teardown for simple dataplane test")
+        logging.info("Teardown for simple dataplane test")
         self.dataplane.kill(join_threads=self.clean_shutdown)
-        basic_logger.info("Teardown done")
+        logging.info("Teardown done")
 
     def runTest(self):
-        basic_logger.info("DataPlaneOnly")
+        logging.info("DataPlaneOnly")
         # self.dataplane.show()
         # Would like an assert that checks the data plane
 
@@ -265,7 +257,7 @@
         # Send packet to dataplane, once to each port
         # Poll controller with expect message type packet in
 
-        rc = delete_all_flows(self.controller, basic_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
@@ -279,7 +271,7 @@
                (simple_eth_packet(), "simple Ethernet packet"),
                (simple_eth_packet(pktlen=40), "tiny Ethernet packet")]:
 
-               basic_logger.info("PKT IN test with %s, port %s" % (pt, of_port))
+               logging.info("PKT IN test with %s, port %s" % (pt, of_port))
                self.dataplane.send(of_port, str(pkt))
                #@todo Check for unexpected messages?
                count = 0
@@ -299,8 +291,8 @@
                                'Packet in message not received on port ' + 
                                str(of_port))
                if not dataplane.match_exp_pkt(pkt, response.data):
-                   basic_logger.debug("Sent %s" % format_packet(pkt))
-                   basic_logger.debug("Resp %s" % format_packet(response.data))
+                   logging.debug("Sent %s" % format_packet(pkt))
+                   logging.debug("Resp %s" % format_packet(response.data))
                    self.assertTrue(False,
                                    'Response packet does not match send packet' +
                                    ' for port ' + str(of_port))
@@ -313,7 +305,7 @@
     in message is received from the controller for each
     """
     def runTest(self):
-        rc = delete_all_flows(self.controller, basic_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
@@ -352,7 +344,7 @@
         # Need at least two ports
         self.assertTrue(len(basic_port_map) > 1, "Too few ports for test")
 
-        rc = delete_all_flows(self.controller, basic_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
@@ -360,7 +352,7 @@
         d_port = of_ports[0]
         pkt = simple_eth_packet(dl_dst='ff:ff:ff:ff:ff:ff')
 
-        basic_logger.info("BCast Leak Test, send to port %s" % d_port)
+        logging.info("BCast Leak Test, send to port %s" % d_port)
         self.dataplane.send(d_port, str(pkt))
 
         (of_port, pkt_in, pkt_time) = self.dataplane.poll(exp_pkt=pkt)
@@ -381,7 +373,7 @@
         # Send packet to dataplane
         # Poll controller with expect message type packet in
 
-        rc = delete_all_flows(self.controller, basic_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # These will get put into function
@@ -393,14 +385,14 @@
                (simple_eth_packet(), "simple Ethernet packet"),
                (simple_eth_packet(pktlen=40), "tiny Ethernet packet")]:
 
-               basic_logger.info("PKT OUT test with %s, port %s" % (opt, dp_port))
+               logging.info("PKT OUT test with %s, port %s" % (opt, dp_port))
                msg = message.packet_out()
                msg.data = str(outpkt)
                act = action.action_output()
                act.port = dp_port
                self.assertTrue(msg.actions.add(act), 'Could not add action to msg')
 
-               basic_logger.info("PacketOut to: " + str(dp_port))
+               logging.info("PacketOut to: " + str(dp_port))
                rv = self.controller.message_send(msg)
                self.assertTrue(rv == 0, "Error sending out message")
 
@@ -413,12 +405,12 @@
                                                               exp_pkt=exp_pkt_arg)
 
                self.assertTrue(pkt is not None, 'Packet not received')
-               basic_logger.info("PacketOut: got pkt from " + str(of_port))
+               logging.info("PacketOut: got pkt from " + str(of_port))
                if of_port is not None:
                    self.assertEqual(of_port, dp_port, "Unexpected receive port")
                if not dataplane.match_exp_pkt(outpkt, pkt):
-                   basic_logger.debug("Sent %s" % format_packet(outpkt))
-                   basic_logger.debug("Resp %s" % format_packet(
+                   logging.debug("Sent %s" % format_packet(outpkt))
+                   logging.debug("Resp %s" % format_packet(
                            str(pkt)[:len(str(outpkt))]))
                self.assertEqual(str(outpkt), str(pkt)[:len(str(outpkt))],
                                 'Response packet does not match send packet')
@@ -435,7 +427,7 @@
         # Send packet to dataplane
         # Poll controller with expect message type packet in
 
-        rc = delete_all_flows(self.controller, basic_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # These will get put into function
@@ -448,7 +440,7 @@
                (simple_eth_packet(pktlen=40), "tiny Ethernet packet")]:
 
                dp_ports = of_ports[0:num_ports]
-               basic_logger.info("PKT OUT test with " + opt +
+               logging.info("PKT OUT test with " + opt +
                                  ", ports " + str(dp_ports))
                msg = message.packet_out()
                msg.data = str(outpkt)
@@ -458,13 +450,13 @@
                   self.assertTrue(msg.actions.add(act),
                                   'Could not add action to msg')
 
-               basic_logger.info("PacketOut to: " + str(dp_ports))
+               logging.info("PacketOut to: " + str(dp_ports))
                rv = self.controller.message_send(msg)
                self.assertTrue(rv == 0, "Error sending out message")
 
                receive_pkt_check(self.dataplane, outpkt, dp_ports,
                                  set(of_ports).difference(dp_ports),
-                                 self, basic_logger, basic_config)
+                                 self, basic_config)
 
 class FlowStatsGet(SimpleProtocol):
     """
@@ -473,13 +465,13 @@
     Simply verify stats get transaction
     """
     def runTest(self):
-        basic_logger.info("Running StatsGet")
-        basic_logger.info("Inserting trial flow")
+        logging.info("Running StatsGet")
+        logging.info("Inserting trial flow")
         request = flow_mod_gen(basic_port_map, True)
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Failed to insert test flow")
         
-        basic_logger.info("Sending flow request")
+        logging.info("Sending flow request")
         request = message.flow_stats_request()
         request.out_port = ofp.OFPP_NONE
         request.table_id = 0xff
@@ -487,7 +479,7 @@
         response, pkt = self.controller.transact(request)
         self.assertTrue(response is not None,
                         "Did not get response for flow stats")
-        basic_logger.debug(response.show())
+        logging.debug(response.show())
 
 test_prio["FlowStatsGet"] = -1
 
@@ -498,18 +490,18 @@
     Simply verify table stats get transaction
     """
     def runTest(self):
-        basic_logger.info("Running TableStatsGet")
-        basic_logger.info("Inserting trial flow")
+        logging.info("Running TableStatsGet")
+        logging.info("Inserting trial flow")
         request = flow_mod_gen(basic_port_map, True)
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Failed to insert test flow")
         
-        basic_logger.info("Sending table stats request")
+        logging.info("Sending table stats request")
         request = message.table_stats_request()
         response, pkt = self.controller.transact(request)
         self.assertTrue(response is not None,
                         "Did not get reply for table stats")
-        basic_logger.debug(response.show())
+        logging.debug(response.show())
 
 class DescStatsGet(SimpleProtocol):
     """
@@ -518,14 +510,14 @@
     Simply verify stats get transaction
     """
     def runTest(self):
-        basic_logger.info("Running DescStatsGet")
+        logging.info("Running DescStatsGet")
         
-        basic_logger.info("Sending stats request")
+        logging.info("Sending stats request")
         request = message.desc_stats_request()
         response, pkt = self.controller.transact(request)
         self.assertTrue(response is not None,
                         "Did not get reply for desc stats")
-        basic_logger.debug(response.show())
+        logging.debug(response.show())
 
 class FlowMod(SimpleProtocol):
     """
@@ -535,7 +527,7 @@
     """
 
     def runTest(self):
-        basic_logger.info("Running " + str(self))
+        logging.info("Running " + str(self))
         request = flow_mod_gen(basic_port_map, True)
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Error installing flow mod")
@@ -550,26 +542,25 @@
     """
 
     def runTest(self):
-        basic_logger.info("Running " + str(self))
+        logging.info("Running " + str(self))
         for of_port, ifname in basic_port_map.items(): # Grab first port
             break
 
         (hw_addr, config, advert) = \
-            port_config_get(self.controller, of_port, basic_logger)
+            port_config_get(self.controller, of_port)
         self.assertTrue(config is not None, "Did not get port config")
 
-        basic_logger.debug("No flood bit port " + str(of_port) + " is now " + 
+        logging.debug("No flood bit port " + str(of_port) + " is now " + 
                            str(config & ofp.OFPPC_NO_FLOOD))
 
         rv = port_config_set(self.controller, of_port,
-                             config ^ ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD,
-                             basic_logger)
+                             config ^ ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD)
         self.assertTrue(rv != -1, "Error sending port mod")
 
         # Verify change took place with same feature request
         (hw_addr, config2, advert) = \
-            port_config_get(self.controller, of_port, basic_logger)
-        basic_logger.debug("No flood bit port " + str(of_port) + " is now " + 
+            port_config_get(self.controller, of_port)
+        logging.debug("No flood bit port " + str(of_port) + " is now " + 
                            str(config2 & ofp.OFPPC_NO_FLOOD))
         self.assertTrue(config2 is not None, "Did not get port config2")
         self.assertTrue(config2 & ofp.OFPPC_NO_FLOOD !=
@@ -577,7 +568,7 @@
                         "Bit change did not take")
         # Set it back
         rv = port_config_set(self.controller, of_port, config, 
-                             ofp.OFPPC_NO_FLOOD, basic_logger)
+                             ofp.OFPPC_NO_FLOOD)
         self.assertTrue(rv != -1, "Error sending port mod")
 
 class PortConfigModErr(SimpleProtocol):
@@ -587,7 +578,7 @@
     """
 
     def runTest(self):
-        basic_logger.info("Running " + str(self))
+        logging.info("Running " + str(self))
 
         # pick a random bad port number
         bad_port = random.randint(1, ofp.OFPP_MAX)
@@ -596,11 +587,10 @@
             bad_port = random.randint(1, ofp.OFPP_MAX)
             count = count + 1
         self.assertTrue(count < 50, "Error selecting bad port")
-        basic_logger.info("Select " + str(bad_port) + " as invalid port")
+        logging.info("Select " + str(bad_port) + " as invalid port")
 
         rv = port_config_set(self.controller, bad_port,
-                             ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD,
-                             basic_logger)
+                             ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD)
         self.assertTrue(rv != -1, "Error sending port mod")
 
         # poll for error message
@@ -609,7 +599,7 @@
             if not response:  # Timeout
                 break
             if response.code == ofp.OFPPMFC_BAD_PORT:
-                basic_logger.info("Received error message with OFPPMFC_BAD_PORT code")
+                logging.info("Received error message with OFPPMFC_BAD_PORT code")
                 break
             if not basic_config["relax"]:  # Only one attempt to match
                 break
@@ -625,7 +615,7 @@
     """
 
     def runTest(self):
-        basic_logger.info("Running " + str(self))
+        logging.info("Running " + str(self))
         request = illegal_message.illegal_message_type()
 
         reply, pkt = self.controller.transact(request)
diff --git a/tests/bsn_ipmask.py b/tests/bsn_ipmask.py
index 489b980..6a4d389 100644
--- a/tests/bsn_ipmask.py
+++ b/tests/bsn_ipmask.py
@@ -14,8 +14,6 @@
 #@var port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 im_port_map = None
-#@var im_logger Local logger object
-im_logger = None
 #@var im_config Local copy of global configuration data
 im_config = None
 
@@ -27,11 +25,8 @@
     basic.test_set_init(config)
 
     global im_port_map
-    global im_logger
     global im_config
 
-    im_logger = logging.getLogger("ipmask")
-    im_logger.info("Initializing test set")
     im_port_map = config["port_map"]
     im_config = config
 
@@ -68,7 +63,7 @@
         Use the BSN_SET_IP_MASK vendor command to change the IP mask for the
         given wildcard index
         """
-        im_logger.info("Setting index %d to mask is %s" % (index, mask))
+        logging.info("Setting index %d to mask is %s" % (index, mask))
         m = message.vendor()
         m.vendor = 0x005c16c7
         m.data = struct.pack("!LBBBBL", 0, index, 0, 0, 0, mask)
@@ -99,34 +94,34 @@
                          "IP src must be wildcarded")
         for index in range(0, 64):
             mask = self.bsn_get_ip_mask(index)
-            im_logger.info("Index %d mask is %s" %
+            logging.info("Index %d mask is %s" %
                            (index, scapy.utils.ltoa(mask)))
             self.assertEqual(mask, normal_ip_mask(index), "Unexpected IP mask")
 
         for index in range(0, 64):
             mask = normal_ip_mask(index)
             if mask == 0:
-                im_logger.info("Skipping IP wildcard index %d" % index)
+                logging.info("Skipping IP wildcard index %d" % index)
             else:
-                im_logger.info("Testing IP wildcard index %d" % index)
+                logging.info("Testing IP wildcard index %d" % index)
                 self.check_ip_mask(True, index, mask)
                 self.check_ip_mask(False, index, mask)
 
-        im_logger.info("Setting fancy IP masks")
+        logging.info("Setting fancy IP masks")
         for index in range(0, 64):
             self.bsn_set_ip_mask(index, fancy_ip_mask(index))
         for index in range(0, 64):
             mask = self.bsn_get_ip_mask(index)
-            im_logger.info("Index %d mask is %s" %
+            logging.info("Index %d mask is %s" %
                            (index, scapy.utils.ltoa(mask)))
             self.assertEqual(mask, fancy_ip_mask(index), "Unexpected IP mask")
 
         for index in range(0, 64):
             mask = fancy_ip_mask(index)
             if mask == 0:
-                im_logger.info("Skipping IP wildcard index %d" % index)
+                logging.info("Skipping IP wildcard index %d" % index)
             else:
-                im_logger.info("Testing IP wildcard index %d" % index)
+                logging.info("Testing IP wildcard index %d" % index)
                 self.check_ip_mask(True, index, mask)
                 self.check_ip_mask(False, index, mask)
 
@@ -156,7 +151,7 @@
            pkt1 = simple_tcp_packet(ip_src=ip1)
            pkt2 = simple_tcp_packet(ip_src=ip2)
            pkt3 = simple_tcp_packet(ip_src=ip3)
-           msg = lambda ip: im_logger.info("Testing source IP %s" % ip)
+           msg = lambda ip: logging.info("Testing source IP %s" % ip)
         else:
            wildcards = ((ofp.OFPFW_ALL ^ ofp.OFPFW_DL_TYPE ^ ofp.OFPFW_NW_DST_MASK)
                         | (index << ofp.OFPFW_NW_DST_SHIFT))
@@ -164,9 +159,9 @@
            pkt1 = simple_tcp_packet(ip_dst=ip1)
            pkt2 = simple_tcp_packet(ip_dst=ip2)
            pkt3 = simple_tcp_packet(ip_dst=ip3)
-           msg = lambda ip: im_logger.info("Testing dest IP %s" % ip)
+           msg = lambda ip: logging.info("Testing dest IP %s" % ip)
 
-        rc = delete_all_flows(self.controller, im_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         rc = self.controller.message_send(flow_msg_create(
diff --git a/tests/caps.py b/tests/caps.py
index 93403ea..823d55c 100644
--- a/tests/caps.py
+++ b/tests/caps.py
@@ -20,8 +20,6 @@
 #@var caps_port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 caps_port_map = None
-#@var caps_logger Local logger object
-caps_logger = None
 #@var caps_config Local copy of global configuration data
 caps_config = None
 
@@ -38,11 +36,8 @@
     basic.test_set_init(config)
 
     global caps_port_map
-    global caps_logger
     global caps_config
 
-    caps_logger = logging.getLogger("caps")
-    caps_logger.info("Initializing caps test set")
     caps_port_map = config["port_map"]
     caps_config = config
 
@@ -59,7 +54,7 @@
     of_ports = caps_port_map.keys()
     of_ports.sort()
 
-    rv = delete_all_flows(obj.controller, caps_logger)
+    rv = delete_all_flows(obj.controller)
     obj.assertEqual(rv, 0, "Failed to delete all flows")
 
     pkt = simple_tcp_packet()
@@ -78,7 +73,7 @@
 
     request.match = match
     request.buffer_id = 0xffffffff      # set to NONE
-    caps_logger.info(request.show())
+    logging.info(request.show())
 
     tstats = message.table_stats_request()
     try:  # Determine the table index to check (or "all")
@@ -87,14 +82,14 @@
         table_idx = -1  # Accumulate all table counts
 
     # Make sure we can install at least one flow
-    caps_logger.info("Inserting initial flow")
+    logging.info("Inserting initial flow")
     rv = obj.controller.message_send(request)
     obj.assertTrue(rv != -1, "Error installing flow mod")
     obj.assertEqual(do_barrier(obj.controller), 0, "Barrier failed")
     flow_count = 1
 
-    caps_logger.info("Table idx: " + str(table_idx))
-    caps_logger.info("Check every " + str(count_check) + " inserts")
+    logging.info("Table idx: " + str(table_idx))
+    logging.info("Check every " + str(count_check) + " inserts")
 
     while True:
         request.match.nw_src += 1
@@ -104,7 +99,7 @@
             obj.assertEqual(do_barrier(obj.controller), 0, "Barrier failed")
             response, pkt = obj.controller.transact(tstats)
             obj.assertTrue(response is not None, "Get tab stats failed")
-            caps_logger.info(response.show())
+            logging.info(response.show())
             if table_idx == -1:  # Accumulate for all tables
                 active_flows = 0
                 for stats in response.stats:
@@ -114,8 +109,8 @@
             if active_flows != flow_count:
                 break
 
-    caps_logger.error("RESULT: " + str(flow_count) + " flows inserted")
-    caps_logger.error("RESULT: " + str(active_flows) + " flows reported")
+    logging.error("RESULT: " + str(flow_count) + " flows inserted")
+    logging.error("RESULT: " + str(active_flows) + " flows reported")
 
 
 class FillTableExact(basic.SimpleProtocol):
@@ -136,7 +131,7 @@
     you can control which table to check.
     """
     def runTest(self):
-        caps_logger.info("Running " + str(self))
+        logging.info("Running " + str(self))
         flow_caps_common(self)
 
 test_prio["FillTableExact"] = -1
@@ -161,7 +156,7 @@
 
     """
     def runTest(self):
-        caps_logger.info("Running " + str(self))
+        logging.info("Running " + str(self))
         flow_caps_common(self, is_exact=False)
 
 test_prio["FillTableWC"] = -1
diff --git a/tests/cxn.py b/tests/cxn.py
index b658074..2c56692 100644
--- a/tests/cxn.py
+++ b/tests/cxn.py
@@ -22,8 +22,6 @@
 #@var cxn_port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 cxn_port_map = None
-#@var cxn_logger Local logger object
-cxn_logger = None
 #@var cxn_config Local copy of global configuration data
 cxn_config = None
 
@@ -37,11 +35,8 @@
     """
 
     global cxn_port_map
-    global cxn_logger
     global cxn_config
 
-    cxn_logger = logging.getLogger("cxn")
-    cxn_logger.info("Initializing test set")
     cxn_port_map = config["port_map"]
     cxn_config = config
 
@@ -51,7 +46,7 @@
     """
 
     def sig_handler(self, v1, v2):
-        cxn_logger.critical("Received interrupt signal; exiting")
+        logging.critical("Received interrupt signal; exiting")
         print "Received interrupt signal; exiting"
         self.clean_shutdown = False
         self.tearDown()
@@ -75,15 +70,14 @@
                         "Controller startup failed, no switch addr")
 
     def setUp(self):
-        self.logger = cxn_logger
         self.config = cxn_config
         #@todo Test cases shouldn't monkey with signals; move SIGINT handler
         # to top-level oft
         try:
            signal.signal(signal.SIGINT, self.sig_handler)
         except ValueError, e:
-           cxn_logger.info("Could not set SIGINT handler: %s" % e)
-        cxn_logger.info("** START TEST CASE " + str(self))
+           logging.info("Could not set SIGINT handler: %s" % e)
+        logging.info("** START TEST CASE " + str(self))
 
         self.test_timeout = test_param_get(cxn_config,
                                            'handshake_timeout') or 60
@@ -103,14 +97,13 @@
         the state after the sub_test is run must be taken into account
         by subsequent operations.
         """
-        self.logger = parent.logger
         self.config = parent.config
-        cxn_logger.info("** Setup " + str(self) + 
+        logging.info("** Setup " + str(self) + 
                                     " inheriting from " + str(parent))
         self.controller = parent.controller
         
     def tearDown(self):
-        cxn_logger.info("** END TEST CASE " + str(self))
+        logging.info("** END TEST CASE " + str(self))
         self.controller.shutdown()
         if self.clean_shutdown:
             self.controller.join()
@@ -121,7 +114,7 @@
 
     def assertTrue(self, cond, msg):
         if not cond:
-            cxn_logger.error("** FAILED ASSERTION: " + msg)
+            logging.error("** FAILED ASSERTION: " + msg)
         unittest.TestCase.assertTrue(self, cond, msg)
 
 test_prio["BaseHandshake"] = -1
@@ -135,9 +128,9 @@
         self.controllerSetup(cxn_config["controller_host"],
                              cxn_config["controller_port"])
 
-        cxn_logger.info("TCP Connected " + 
+        logging.info("TCP Connected " + 
                         str(self.controller.switch_addr))
-        cxn_logger.info("Hello not sent, waiting for timeout")
+        logging.info("Hello not sent, waiting for timeout")
 
         # wait for controller to die
         count = 0
@@ -156,12 +149,12 @@
         self.controllerSetup(cxn_config["controller_host"],
                              cxn_config["controller_port"])
 
-        cxn_logger.info("TCP Connected " + 
+        logging.info("TCP Connected " + 
                                     str(self.controller.switch_addr))
-        cxn_logger.info("Sending hello")
+        logging.info("Sending hello")
         self.controller.message_send(message.hello())
 
-        cxn_logger.info("Features request not sent, waiting for timeout")
+        logging.info("Features request not sent, waiting for timeout")
 
         # wait for controller to die
         count = 0
@@ -180,16 +173,16 @@
         self.controllerSetup(cxn_config["controller_host"],
                              cxn_config["controller_port"])
 
-        cxn_logger.info("TCP Connected " + 
+        logging.info("TCP Connected " + 
                                     str(self.controller.switch_addr))
-        cxn_logger.info("Sending hello")
+        logging.info("Sending hello")
         self.controller.message_send(message.hello())
 
         request = message.features_request()
         reply, pkt = self.controller.transact(request, timeout=20)
         self.assertTrue(reply is not None,
                         "Did not complete features_request for handshake")
-        cxn_logger.info("Handshake complete with " + 
+        logging.info("Handshake complete with " + 
                         str(self.controller.switch_addr))
 
         self.controller.keep_alive = True
diff --git a/tests/detailed_contr_sw_messages.py b/tests/detailed_contr_sw_messages.py
index d45935d..b13659d 100644
--- a/tests/detailed_contr_sw_messages.py
+++ b/tests/detailed_contr_sw_messages.py
@@ -22,7 +22,6 @@
 from FuncUtils import *
 
 cs_port_map = None
-cs_logger = None
 cs_config = None
 
 def test_set_init(config):
@@ -31,11 +30,8 @@
     basic.test_set_init(config)
 
     global cs_port_map
-    global cs_logger
     global cs_config
 
-    cs_logger = logging.getLogger("Detailed controller to switch messages")
-    cs_logger.info("Initializing test set")
     cs_port_map = config["port_map"]
     cs_config = config
 
@@ -47,18 +43,18 @@
     
     def runTest(self):
         
-        cs_logger.info("Running Overlap_Checking test")
+        logging.info("Running Overlap_Checking test")
        
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear Switch State
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting two overlapping flows")
-        cs_logger.info("Expecting switch to return an error")
+        logging.info("Inserting two overlapping flows")
+        logging.info("Expecting switch to return an error")
 
         #Insert a flow F with wildcarded all fields
         (pkt,match) = Wildcard_All(self,of_ports)
@@ -107,18 +103,18 @@
     
     def runTest(self):
      
-        cs_logger.info("Running No_Overlap_Checking test")
+        logging.info("Running No_Overlap_Checking test")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear Switch State
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting two overlapping flows")
-        cs_logger.info("Expecting switch to insert the flows without generating errors")
+        logging.info("Inserting two overlapping flows")
+        logging.info("Expecting switch to insert the flows without generating errors")
 
         #Build a flow F with wildcarded all fields.
         (pkt,match) = Wildcard_All(self,of_ports)
@@ -139,18 +135,18 @@
 
     def runTest(self):
         
-        cs_logger.info("Running Identical_Flows test ")
+        logging.info("Running Identical_Flows test ")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting two identical flows one by one")
-        cs_logger.info("Expecting switch to overwrite the first flow and clear the counters associated with it ")
+        logging.info("Inserting two identical flows one by one")
+        logging.info("Expecting switch to overwrite the first flow and clear the counters associated with it ")
         
         # Create and add flow-1, check on dataplane it is active.
         (pkt,match) = Wildcard_All(self,of_ports)
@@ -180,18 +176,18 @@
 
     def runTest(self):
 
-        cs_logger.info("Running Emergency_Flow_Timeout test")
+        logging.info("Running Emergency_Flow_Timeout test")
         
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting an emergency flow with timeout values")
-        cs_logger.info("Expecting switch to generate error ")
+        logging.info("Inserting an emergency flow with timeout values")
+        logging.info("Expecting switch to generate error ")
         
         #Insert an emergency flow 
         pkt = simple_tcp_packet()
@@ -209,7 +205,7 @@
         act.port = of_ports[1]
         
         request.actions.add(act)
-        cs_logger.info("Inserting flow")
+        logging.info("Inserting flow")
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Flow addition did not fail.")
 
@@ -232,17 +228,17 @@
     
     def runTest(self):
         
-        cs_logger.info("Running Missing_Modify_Add test")
+        logging.info("Running Missing_Modify_Add test")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
-        cs_logger.info("Inserting a flow-modify that does not match an existing flow")
-        cs_logger.info("Expecting flow to get added i.e OFPFC_MODIFY command should be taken as OFPFC_ADD ")
+        logging.info("Inserting a flow-modify that does not match an existing flow")
+        logging.info("Expecting flow to get added i.e OFPFC_MODIFY command should be taken as OFPFC_ADD ")
 
         #Clear Switch State
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         #Generate a flow-mod,command OFPC_MODIFY 
@@ -257,7 +253,7 @@
         act3.port = of_ports[1]
         self.assertTrue(request.actions.add(act3), "could not add action")
 
-        cs_logger.info("Inserting flow")
+        logging.info("Inserting flow")
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed") 
@@ -272,18 +268,18 @@
     
     def runTest(self):
         
-        cs_logger.info("Running Modify_Action test ")
+        logging.info("Running Modify_Action test ")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting a Flow and incrementing flow counters. Modifying the flow action")
-        cs_logger.info("Expecting the flow action to be modified , but the flow-counters should be preserved")
+        logging.info("Inserting a Flow and incrementing flow counters. Modifying the flow action")
+        logging.info("Expecting the flow action to be modified , but the flow-counters should be preserved")
            
         #Create and add flow-1 Match on all, except one wildcarded (src adddress).Action A , output to of_port[1]
         (pkt,match) = Match_All_Except_Source_Address(self,of_ports)
@@ -310,18 +306,18 @@
 
     def runTest(self):
         
-        cs_logger.info("Running Strict_Modify_Action test")
+        logging.info("Running Strict_Modify_Action test")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting Flows and incrementing flow counters. Strict Modify the flow action ")
-        cs_logger.info("Expecting the flow action to be modified , but the flow-counters should be preserved")
+        logging.info("Inserting Flows and incrementing flow counters. Strict Modify the flow action ")
+        logging.info("Expecting the flow action to be modified , but the flow-counters should be preserved")
         
         #Create and add flow-1 Match on all, except one wildcarded (src adddress).Action A
         (pkt,match) = Match_All_Except_Source_Address(self,of_ports,priority=100)
@@ -354,18 +350,18 @@
     
     def runTest(self):
         
-        cs_logger.info("Delete_NonExisting_Flow test begins")
+        logging.info("Delete_NonExisting_Flow test begins")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Deleting a non-existing flow")
-        cs_logger.info("Expecting switch to ignore the command , without generating errors")
+        logging.info("Deleting a non-existing flow")
+        logging.info("Expecting switch to ignore the command , without generating errors")
 
         # Issue a delete command 
         msg = message.flow_mod()
@@ -390,19 +386,19 @@
 
     def runTest(self):
 
-        cs_logger.info("Running Send_Flow_Rem test ")
+        logging.info("Running Send_Flow_Rem test ")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear swicth state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting flows F1 and F2 without and with send_flow_removed_message flag set ")
-        cs_logger.info("Deleting the flows")
-        cs_logger.info("Expecting flow removed message only for F2")
+        logging.info("Inserting flows F1 and F2 without and with send_flow_removed_message flag set ")
+        logging.info("Deleting the flows")
+        logging.info("Expecting flow removed message only for F2")
 
         # Insert flow-1 with F without OFPFF_SEND_FLOW_REM flag set.
         (pkt,match) = Wildcard_All_Except_Ingress(self,of_ports)
@@ -432,7 +428,7 @@
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
         # Delete the flow-2
-        rc2 = delete_all_flows(self.controller, cs_logger)
+        rc2 = delete_all_flows(self.controller)
         self.assertEqual(rc2, 0, "Failed to delete all flows")
 
         # Verify flow removed message is generated for the FLOW-2
@@ -450,17 +446,17 @@
 
     def runTest(self):
 
-        cs_logger.info("Running Delete_Emer_Flow")
+        logging.info("Running Delete_Emer_Flow")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         
         #Clear switch state        
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting a emergency flow with send_flow_removed flag set")
-        cs_logger.info("Expecting no flow_removed_message on the deletion of the emergency flow")
+        logging.info("Inserting a emergency flow with send_flow_removed flag set")
+        logging.info("Expecting no flow_removed_message on the deletion of the emergency flow")
         
         # Insert a flow with emergency bit set.
         pkt = simple_tcp_packet()
@@ -493,18 +489,18 @@
 
     def runTest(self):
         
-        cs_logger.info("Strict_Vs_Nonstrict test begins")
+        logging.info("Strict_Vs_Nonstrict test begins")
         
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
         
-        cs_logger.info("Inserting a flow with exact match")
-        cs_logger.info("Issue Strict Delete command , verify it gets deleted")     
+        logging.info("Inserting a flow with exact match")
+        logging.info("Issue Strict Delete command , verify it gets deleted")     
         
         #Insert F with an exact Match 
         (pkt,match) = Exact_Match(self,of_ports)  
@@ -514,9 +510,9 @@
         Strict_Delete(self,match)
         Verify_TableStats(self,active_entries=0)
 
-        cs_logger.info("Inserting two overlapping flows")
-        cs_logger.info("Issue Strict Delete command ")
-        cs_logger.info("Expecting only one flow gets deleted , because Strict Delete matches on wildcards as well")     
+        logging.info("Inserting two overlapping flows")
+        logging.info("Issue Strict Delete command ")
+        logging.info("Expecting only one flow gets deleted , because Strict Delete matches on wildcards as well")     
         
         #Insert Flow T with match on all , except one wildcarded ( say src adddress ). 
         (pkt,match) = Match_All_Except_Source_Address(self,of_ports)
@@ -529,9 +525,9 @@
         Strict_Delete(self,match1)
         Verify_TableStats(self,active_entries=1) 
 
-        cs_logger.info("Inserting two overlapping flows")
-        cs_logger.info("Issue Non-Strict Delete command ")
-        cs_logger.info("Expecting both the flow gets deleted , because wildcards are active")    
+        logging.info("Inserting two overlapping flows")
+        logging.info("Issue Non-Strict Delete command ")
+        logging.info("Expecting both the flow gets deleted , because wildcards are active")    
 
         #Insert T and T' again . 
         (pkt,match) = Match_All_Except_Source_Address(self,of_ports)
@@ -542,9 +538,9 @@
         NonStrict_Delete(self,match1)
         Verify_TableStats(self,active_entries=0)
 
-        cs_logger.info("Inserting three overlapping flows with different priorities")
-        cs_logger.info("Issue Non-Strict Delete command ")
-        cs_logger.info("Expecting all the flows to get deleted")  
+        logging.info("Inserting three overlapping flows with different priorities")
+        logging.info("Issue Non-Strict Delete command ")
+        logging.info("Expecting all the flows to get deleted")  
   
         #Insert T , add Priority P (say 100 ) 
         (pkt,match) = Match_All_Except_Source_Address(self,of_ports,priority=100)
@@ -560,9 +556,9 @@
         NonStrict_Delete(self,match1,priority=200)
         Verify_TableStats(self,active_entries=0)
 
-        cs_logger.info("Inserting three overlapping flows with different priorities")
-        cs_logger.info("Issue Strict Delete command ")
-        cs_logger.info("Expecting only one to get deleted because here priorities & wildcards are being matched")  
+        logging.info("Inserting three overlapping flows with different priorities")
+        logging.info("Issue Strict Delete command ")
+        logging.info("Expecting only one to get deleted because here priorities & wildcards are being matched")  
 
         #Issue Strict-Delete and verify only T'' gets deleted. 
         (pkt,match) = Match_All_Except_Source_Address(self,of_ports,priority=100)
@@ -580,19 +576,19 @@
 
     def runTest(self):
         
-        cs_logger.info("Outport1 test begins")
+        logging.info("Outport1 test begins")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting a flow with output action --> of_port[1]")
-        cs_logger.info("Deleting the flow but with out_port set to of_port[2]")
-        cs_logger.info("Expecting switch to filter the delete command")
+        logging.info("Inserting a flow with output action --> of_port[1]")
+        logging.info("Deleting the flow but with out_port set to of_port[2]")
+        logging.info("Expecting switch to filter the delete command")
         
         #Build and send Flow-1 with action output to of_port[1]
         (pkt,match) = Wildcard_All_Except_Ingress(self,of_ports)
@@ -614,8 +610,8 @@
         # Verify flow will not get deleted, active_entries in table_stats_request = 1
         Verify_TableStats(self,active_entries=1)
 
-        cs_logger.info("Deleting the flow with out_port set to of_port[1]")
-        cs_logger.info("Expecting switch to delete the flow")
+        logging.info("Deleting the flow with out_port set to of_port[1]")
+        logging.info("Expecting switch to delete the flow")
 
         #Send Delete command with contraint out_port = of_ports[1]
         msg7 = message.flow_mod()
@@ -638,18 +634,18 @@
 
     def runTest(self):
         
-        cs_logger.info("Running Idle_Timeout test ")
+        logging.info("Running Idle_Timeout test ")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
         
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting flow entry with idle_timeout set. Also send_flow_removed_message flag set")
-        cs_logger.info("Expecting the flow entry to delete with given idle_timeout")
+        logging.info("Inserting flow entry with idle_timeout set. Also send_flow_removed_message flag set")
+        logging.info("Expecting the flow entry to delete with given idle_timeout")
 
         #Insert a flow entry with idle_timeout=1.Send_Flow_Rem flag set
         msg9 = message.flow_mod()
@@ -682,18 +678,18 @@
 
     def runTest(self):
         
-        cs_logger.info("Running Outport2 test ")
+        logging.info("Running Outport2 test ")
 
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Adding and modifying flow with out_port fields set")
-        cs_logger.info("Expecting switch to ignore out_port")
+        logging.info("Adding and modifying flow with out_port fields set")
+        logging.info("Expecting switch to ignore out_port")
 
         # Create and add flow-1,Action A ,output to port of_port[1], out_port set to of_ports[2]
         (pkt,match) = Wildcard_All_Except_Ingress(self,of_ports)
@@ -722,18 +718,18 @@
 
     def runTest(self):
 
-        cs_logger.info("Running Hard_Timeout test ")
+        logging.info("Running Hard_Timeout test ")
         
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting flow entry with hard_timeout set. Also send_flow_removed_message flag set")
-        cs_logger.info("Expecting the flow entry to delete with given hard_timeout")
+        logging.info("Inserting flow entry with hard_timeout set. Also send_flow_removed_message flag set")
+        logging.info("Expecting the flow entry to delete with given hard_timeout")
 
         # Insert a flow entry with hardtimeout=1 and send_flow_removed flag set
         msg9 = message.flow_mod()
@@ -769,18 +765,18 @@
     
     def runTest(self):
 
-        cs_logger.info("Running Flow_Timeout test ")
+        logging.info("Running Flow_Timeout test ")
         
         of_ports = cs_port_map.keys()
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, cs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        cs_logger.info("Inserting flow entry with hard_timeout set and send_flow_removed_message flag not set")
-        cs_logger.info("Expecting the flow entry to delete, but no flow removed message")
+        logging.info("Inserting flow entry with hard_timeout set and send_flow_removed_message flag not set")
+        logging.info("Expecting the flow entry to delete, but no flow removed message")
 
         # Insert a flow with hard_timeout = 1 but no Send_Flow_Rem flag set
         pkt = simple_tcp_packet()
diff --git a/tests/flow_expire.py b/tests/flow_expire.py
index 9be5fdd..20d8efc 100644
--- a/tests/flow_expire.py
+++ b/tests/flow_expire.py
@@ -23,8 +23,6 @@
 #@var port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 fe_port_map = None
-#@var fe_logger Local logger object
-fe_logger = None
 #@var fe_config Local copy of global configuration data
 fe_config = None
 
@@ -38,11 +36,8 @@
     basic.test_set_init(config)
 
     global fe_port_map
-    global fe_logger
     global fe_config
 
-    fe_logger = logging.getLogger("flow_expire")
-    fe_logger.info("Initializing test set")
     fe_port_map = config["port_map"]
     fe_config = config
 
@@ -64,7 +59,7 @@
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
-        rc = delete_all_flows(self.controller, fe_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         pkt = simple_tcp_packet()
@@ -80,7 +75,7 @@
 
         ingress_port = of_ports[0]
         egress_port  = of_ports[1]
-        fe_logger.info("Ingress " + str(ingress_port) + 
+        logging.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
         
         match.in_port = ingress_port
@@ -94,7 +89,7 @@
         act.port = egress_port
         self.assertTrue(request.actions.add(act), "Could not add action")
         
-        fe_logger.info("Inserting flow")
+        logging.info("Inserting flow")
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
diff --git a/tests/flow_query.py b/tests/flow_query.py
index 3017eed..9931c89 100644
--- a/tests/flow_query.py
+++ b/tests/flow_query.py
@@ -80,8 +80,6 @@
 #@var port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 fq_port_map = None
-#@var fq_logger Local logger object
-fq_logger = None
 #@var fq_config Local copy of global configuration data
 fq_config = None
 
@@ -99,11 +97,8 @@
     basic.test_set_init(config)
 
     global fq_port_map
-    global fq_logger
     global fq_config
 
-    fq_logger = logging.getLogger("flowq")
-    fq_logger.info("Initializing test set")
     fq_port_map = config["port_map"]
     fq_config = config
 
@@ -179,8 +174,8 @@
         if test_param_get(fq_config, "vlans", []) != []:
            self.vlans = test_param_get(fq_config, "vlans", [])
 
-           fq_logger.info("Overriding VLAN ids to:")
-           fq_logger.info(self.vlans)
+           logging.info("Overriding VLAN ids to:")
+           logging.info(self.vlans)
         else:
            self.vlans = []
            i = 0
@@ -529,8 +524,8 @@
 
         actions_force = test_param_get(fq_config, "actions_force", 0)
         if actions_force != 0:
-            fq_logger.info("Forced actions:")
-            fq_logger.info(actions_bmap_to_str(actions_force))
+            logging.info("Forced actions:")
+            logging.info(actions_bmap_to_str(actions_force))
 
         ACTION_MAX_LEN = 65535 # @fixme Should be test param?
         supported_actions = []
@@ -642,8 +637,8 @@
 
         actions_force = test_param_get(fq_config, "actions_force", 0)
         if actions_force != 0:
-            fq_logger.info("Forced actions:")
-            fq_logger.info(actions_bmap_to_str(actions_force))
+            logging.info("Forced actions:")
+            logging.info(actions_bmap_to_str(actions_force))
 
         ACTION_MAX_LEN = 65535 # @fixme Should be test param?
         supported_actions = []
@@ -727,8 +722,8 @@
     def rand(self, fi, wildcards_force, valid_wildcards, valid_actions, valid_ports,
              valid_queues):
         if wildcards_force != 0:
-            fq_logger.info("Wildcards forced:")
-            fq_logger.info(wildcards_to_str(wildcards_force))
+            logging.info("Wildcards forced:")
+            logging.info(wildcards_to_str(wildcards_force))
         
         # Start with no wildcards, i.e. everything specified
         self.match.wildcards = 0
@@ -1236,17 +1231,17 @@
         self.removed_msgs = []
 
     def error_handler(self, controller, msg, rawmsg):
-        fq_logger.info("Got an ERROR message, type=%d, code=%d" \
+        logging.info("Got an ERROR message, type=%d, code=%d" \
                           % (msg.type, msg.code) \
                           )
-        fq_logger.info("Message header:")
-        fq_logger.info(msg.header.show())
+        logging.info("Message header:")
+        logging.info(msg.header.show())
         self.error_msgs.append(msg)
 
     def removed_handler(self, controller, msg, rawmsg):
-        fq_logger.info("Got a REMOVED message")
-        fq_logger.info("Message header:")
-        fq_logger.info(msg.header.show())
+        logging.info("Got a REMOVED message")
+        logging.info("Message header:")
+        logging.info(msg.header.show())
         self.removed_msgs.append(msg)
 
     def controller_set(self, controller):
@@ -1262,15 +1257,15 @@
         request = message.features_request()
         (self.sw_features, pkt) = self.controller.transact(request)
         if self.sw_features is None:
-            fq_logger.error("Get switch features failed")
+            logging.error("Get switch features failed")
             return False
         self.valid_ports = map(lambda x: x.port_no, self.sw_features.ports)
-        fq_logger.info("Ports reported by switch:")
-        fq_logger.info(self.valid_ports)
+        logging.info("Ports reported by switch:")
+        logging.info(self.valid_ports)
         ports_override = test_param_get(fq_config, "ports", [])
         if ports_override != []:
-            fq_logger.info("Overriding ports to:")
-            fq_logger.info(ports_override)
+            logging.info("Overriding ports to:")
+            logging.info(ports_override)
             self.valid_ports = ports_override
         
         # TBD - OFPP_LOCAL is returned by OVS is switch features --
@@ -1286,16 +1281,16 @@
 #                                  ofp.OFPP_CONTROLLER \
 #                                  ] \
 #                                 )
-        fq_logger.info("Supported actions reported by switch:")
-        fq_logger.info("0x%x=%s" \
+        logging.info("Supported actions reported by switch:")
+        logging.info("0x%x=%s" \
                        % (self.sw_features.actions, \
                           actions_bmap_to_str(self.sw_features.actions) \
                           ) \
                        )
         actions_override = test_param_get(fq_config, "actions", -1)
         if actions_override != -1:
-            fq_logger.info("Overriding supported actions to:")
-            fq_logger.info(actions_bmap_to_str(actions_override))
+            logging.info("Overriding supported actions to:")
+            logging.info(actions_bmap_to_str(actions_override))
             self.sw_features.actions = actions_override
         return True
 
@@ -1304,24 +1299,24 @@
         request = message.table_stats_request()
         (self.tbl_stats, pkt) = self.controller.transact(request)
         if self.tbl_stats is None:
-            fq_logger.error("Get table stats failed")
+            logging.error("Get table stats failed")
             return False
         i = 0
         for ts in self.tbl_stats.stats:
-            fq_logger.info("Supported wildcards for table %d reported by switch:"
+            logging.info("Supported wildcards for table %d reported by switch:"
                            % (i)
                            )
-            fq_logger.info("0x%x=%s" \
+            logging.info("0x%x=%s" \
                            % (ts.wildcards, \
                               wildcards_to_str(ts.wildcards) \
                               ) \
                            )
             wildcards_override = test_param_get(fq_config, "wildcards", -1)
             if wildcards_override != -1:
-                fq_logger.info("Overriding supported wildcards for table %d to:"
+                logging.info("Overriding supported wildcards for table %d to:"
                                % (i)
                                )
-                fq_logger.info(wildcards_to_str(wildcards_override))
+                logging.info(wildcards_to_str(wildcards_override))
                 ts.wildcards = wildcards_override
             i = i + 1
         return True
@@ -1333,17 +1328,17 @@
         request.queue_id = ofp.OFPQ_ALL
         (self.queue_stats, pkt) = self.controller.transact(request)
         if self.queue_stats is None:
-            fq_logger.error("Get queue stats failed")
+            logging.error("Get queue stats failed")
             return False
         self.valid_queues = map(lambda x: (x.port_no, x.queue_id), \
                                 self.queue_stats.stats \
                                 )
-        fq_logger.info("(Port, queue) pairs reported by switch:")
-        fq_logger.info(self.valid_queues)
+        logging.info("(Port, queue) pairs reported by switch:")
+        logging.info(self.valid_queues)
         queues_override = test_param_get(fq_config, "queues", [])
         if queues_override != []:
-            fq_logger.info("Overriding (port, queue) pairs to:")
-            fq_logger.info(queues_override)
+            logging.info("Overriding (port, queue) pairs to:")
+            logging.info(queues_override)
             self.valid_queues = queues_override
         return True
 
@@ -1380,7 +1375,7 @@
                 self.flow_stats.stats.extend(resp.stats)
             n = n + 1
             if len(self.flow_stats.stats) > limit:
-                fq_logger.error("Too many flows returned")
+                logging.error("Too many flows returned")
                 return False
             if (resp.flags & 1) == 0:
                 break                   # No more responses expected
@@ -1396,7 +1391,7 @@
         if flow_cfg.send_rem:
             flow_mod_msg.flags = flow_mod_msg.flags | ofp.OFPFF_SEND_FLOW_REM
         flow_mod_msg.header.xid = random.randrange(1,0xffffffff)
-        fq_logger.info("Sending flow_mod(add), xid=%d"
+        logging.info("Sending flow_mod(add), xid=%d"
                         % (flow_mod_msg.header.xid)
                         )
         return (self.controller.message_send(flow_mod_msg) != -1)
@@ -1408,7 +1403,7 @@
         flow_mod_msg.buffer_id   = 0xffffffff
         flow_cfg.to_flow_mod_msg(flow_mod_msg)
         flow_mod_msg.header.xid = random.randrange(1,0xffffffff)
-        fq_logger.info("Sending flow_mod(mod), xid=%d"
+        logging.info("Sending flow_mod(mod), xid=%d"
                         % (flow_mod_msg.header.xid)
                         )
         return (self.controller.message_send(flow_mod_msg) != -1)
@@ -1422,7 +1417,7 @@
         flow_mod_msg.out_port    = ofp.OFPP_NONE
         flow_cfg.to_flow_mod_msg(flow_mod_msg)
         flow_mod_msg.header.xid = random.randrange(1,0xffffffff)
-        fq_logger.info("Sending flow_mod(del), xid=%d"
+        logging.info("Sending flow_mod(del), xid=%d"
                         % (flow_mod_msg.header.xid)
                         )
         return (self.controller.message_send(flow_mod_msg) != -1)
@@ -1434,42 +1429,42 @@
 
     def errors_verify(self, num_exp, type = 0, code = 0):
         result = True
-        fq_logger.info("Expecting %d error messages" % (num_exp))
+        logging.info("Expecting %d error messages" % (num_exp))
         num_got = len(self.error_msgs)
-        fq_logger.info("Got %d error messages" % (num_got))
+        logging.info("Got %d error messages" % (num_got))
         if num_got != num_exp:
-            fq_logger.error("Incorrect number of error messages received")
+            logging.error("Incorrect number of error messages received")
             result = False
         if num_exp == 0:
             return result
         elif num_exp == 1:
-            fq_logger.info("Expecting error message, type=%d, code=%d" \
+            logging.info("Expecting error message, type=%d, code=%d" \
                             % (type, code) \
                             )
             f = False
             for e in self.error_msgs:
                 if e.type == type and e.code == code:
-                    fq_logger.info("Got it")
+                    logging.info("Got it")
                     f = True
             if not f:
-                fq_logger.error("Did not get it")
+                logging.error("Did not get it")
                 result = False
         else:
-            fq_logger.error("Can't expect more than 1 error message type")
+            logging.error("Can't expect more than 1 error message type")
             result = False
         return result
 
     def removed_verify(self, num_exp):
         result = True
-        fq_logger.info("Expecting %d removed messages" % (num_exp))
+        logging.info("Expecting %d removed messages" % (num_exp))
         num_got = len(self.removed_msgs)
-        fq_logger.info("Got %d removed messages" % (num_got))
+        logging.info("Got %d removed messages" % (num_got))
         if num_got != num_exp:
-            fq_logger.error("Incorrect number of removed messages received")
+            logging.error("Incorrect number of removed messages received")
             result = False
         if num_exp < 2:
             return result
-        fq_logger.error("Can't expect more than 1 error message type")
+        logging.error("Can't expect more than 1 error message type")
         return False
 
     # modf == True <=> Verify for flow modify, else for add/delete
@@ -1477,88 +1472,88 @@
         result = True
     
         # Verify flow count in switch
-        fq_logger.info("Reading table stats")
-        fq_logger.info("Expecting %d flows" % (self.flow_tbl.count()))
+        logging.info("Reading table stats")
+        logging.info("Expecting %d flows" % (self.flow_tbl.count()))
         if not self.tbl_stats_get():
-            fq_logger.error("Get table stats failed")
+            logging.error("Get table stats failed")
             return False
         n = 0
         for ts in self.tbl_stats.stats:
             n = n + ts.active_count
-        fq_logger.info("Table stats reported %d active flows" \
+        logging.info("Table stats reported %d active flows" \
                           % (n) \
                           )
         if n != self.flow_tbl.count():
-            fq_logger.error("Incorrect number of active flows reported")
+            logging.error("Incorrect number of active flows reported")
             result = False
     
         # Read flows from switch
-        fq_logger.info("Retrieving flows from switch")
-        fq_logger.info("Expecting %d flows" % (self.flow_tbl.count()))
+        logging.info("Retrieving flows from switch")
+        logging.info("Expecting %d flows" % (self.flow_tbl.count()))
         if not self.flow_stats_get():
-            fq_logger.error("Get flow stats failed")
+            logging.error("Get flow stats failed")
             return False
-        fq_logger.info("Retrieved %d flows" % (len(self.flow_stats.stats)))
+        logging.info("Retrieved %d flows" % (len(self.flow_stats.stats)))
     
         # Verify flows returned by switch
     
         if len(self.flow_stats.stats) != self.flow_tbl.count():
-            fq_logger.error("Switch reported incorrect number of flows")
+            logging.error("Switch reported incorrect number of flows")
             result = False
     
-        fq_logger.info("Verifying received flows")
+        logging.info("Verifying received flows")
         for fc in self.flow_tbl.values():
             fc.matched = False
         for fs in self.flow_stats.stats:
             flow_in = Flow_Cfg()
             flow_in.from_flow_stat(fs)
-            fq_logger.info("Received flow:")
-            fq_logger.info(str(flow_in))
+            logging.info("Received flow:")
+            logging.info(str(flow_in))
             fc = self.flow_tbl.find(flow_in)
             if fc is None:
-                fq_logger.error("Received flow:")
-                fq_logger.error(str(flow_in))
-                fq_logger.error("does not match any defined flow")
+                logging.error("Received flow:")
+                logging.error(str(flow_in))
+                logging.error("does not match any defined flow")
                 result = False
             elif fc.matched:
-                fq_logger.error("Received flow:")
-                fq_logger.error(str(flow_in))
-                fq_logger.error("re-matches defined flow:")
-                fq_logger.info(str(fc))
+                logging.error("Received flow:")
+                logging.error(str(flow_in))
+                logging.error("re-matches defined flow:")
+                logging.info(str(fc))
                 result = False
             else:
-                fq_logger.info("matched")
+                logging.info("matched")
                 if modf:
                     # Check for modify
                     
                     if flow_in.cookie != fc.cookie:
-                        fq_logger.warning("Defined flow:")
-                        fq_logger.warning(str(fc))
-                        fq_logger.warning("Received flow:")
-                        fq_logger.warning(str(flow_in))
-                        fq_logger.warning("cookies do not match")
+                        logging.warning("Defined flow:")
+                        logging.warning(str(fc))
+                        logging.warning("Received flow:")
+                        logging.warning(str(flow_in))
+                        logging.warning("cookies do not match")
                     if not flow_in.actions_equal(fc):
-                        fq_logger.error("Defined flow:")
-                        fq_logger.error(str(fc))
-                        fq_logger.error("Received flow:")
-                        fq_logger.error(str(flow_in))
-                        fq_logger.error("actions do not match")
+                        logging.error("Defined flow:")
+                        logging.error(str(fc))
+                        logging.error("Received flow:")
+                        logging.error(str(flow_in))
+                        logging.error("actions do not match")
                 else:
                     # Check for add/delete
                     
                     if not flow_in == fc:
-                        fq_logger.error("Defined flow:")
-                        fq_logger.error(str(fc))
-                        fq_logger.error("Received flow:")
-                        fq_logger.error(str(flow_in))
-                        fq_logger.error("non-key portions of flow do not match")
+                        logging.error("Defined flow:")
+                        logging.error(str(fc))
+                        logging.error("Received flow:")
+                        logging.error(str(flow_in))
+                        logging.error("non-key portions of flow do not match")
                         result = False
                 fc.matched = True
         for fc in self.flow_tbl.values():
             if not fc.matched:
-                fq_logger.error("Defined flow:")
-                fq_logger.error(str(fc))
-                fq_logger.error("was not returned by switch")
+                logging.error("Defined flow:")
+                logging.error(str(fc))
+                logging.error("was not returned by switch")
                 result = False
     
         return result
@@ -1605,14 +1600,14 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Add_5 TEST BEGIN")
+        logging.info("Flow_Add_5 TEST BEGIN")
 
         num_flows = test_param_get(fq_config, "num_flows", 100)
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -1629,7 +1624,7 @@
             for ts in sw.tbl_stats.stats:
                 num_flows = num_flows + ts.max_entries
 
-        fq_logger.info("Generating %d flows" % (num_flows))        
+        logging.info("Generating %d flows" % (num_flows))        
 
         # Dream up some flow information, i.e. space to chose from for
         # random flow parameter generation
@@ -1644,10 +1639,10 @@
 
         # Send flow table to switch
 
-        fq_logger.info("Sending flow adds to switch")
+        logging.info("Sending flow adds to switch")
         for fc in ft.values():          # Randomizes order of sending
-            fq_logger.info("Adding flow:")
-            fq_logger.info(str(fc));
+            logging.info("Adding flow:")
+            logging.info(str(fc));
             self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -1670,7 +1665,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Add_5 TEST FAILED")
-        fq_logger.info("Flow_Add_5 TEST PASSED")
+        logging.info("Flow_Add_5 TEST PASSED")
 
 
 # FLOW ADD 5_1
@@ -1707,14 +1702,14 @@
     """
     
     def runTest(self):
-        fq_logger.info("Flow_Add_5_1 TEST BEGIN")
+        logging.info("Flow_Add_5_1 TEST BEGIN")
 
         num_flows = test_param_get(fq_config, "num_flows", 100)
         
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -1750,10 +1745,10 @@
 
         # Send it to the switch
 
-        fq_logger.info("Sending flow add to switch:")
-        fq_logger.info(str(fc))
-        fq_logger.info("should be canonicalized as:")
-        fq_logger.info(str(fcc))
+        logging.info("Sending flow add to switch:")
+        logging.info(str(fc))
+        logging.info("should be canonicalized as:")
+        logging.info(str(fcc))
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
@@ -1777,7 +1772,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Add_5_1 TEST FAILED")
-        fq_logger.info("Flow_Add_5_1 TEST PASSED")
+        logging.info("Flow_Add_5_1 TEST PASSED")
 
 
 # FLOW ADD 6
@@ -1824,12 +1819,12 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Add_6 TEST BEGIN")
+        logging.info("Flow_Add_6 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -1843,8 +1838,8 @@
         for ts in sw.tbl_stats.stats:
             num_flows = num_flows + ts.max_entries
 
-        fq_logger.info("Switch capacity is %d flows" % (num_flows))        
-        fq_logger.info("Generating %d flows" % (num_flows))        
+        logging.info("Switch capacity is %d flows" % (num_flows))        
+        logging.info("Generating %d flows" % (num_flows))        
 
         # Dream up some flow information, i.e. space to chose from for
         # random flow parameter generation
@@ -1859,10 +1854,10 @@
 
         # Send flow table to switch
 
-        fq_logger.info("Sending flow adds to switch")
+        logging.info("Sending flow adds to switch")
         for fc in ft.values():          # Randomizes order of sending
-            fq_logger.info("Adding flow:")
-            fq_logger.info(str(fc));
+            logging.info("Adding flow:")
+            logging.info(str(fc));
             self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -1880,7 +1875,7 @@
 
         # Dream up one more flow
 
-        fq_logger.info("Creating one more flow")
+        logging.info("Creating one more flow")
         while True:
             fc = Flow_Cfg()
             fc.rand(fi, \
@@ -1897,8 +1892,8 @@
         # Send one-more flow
 
         fc.send_rem = False
-        fq_logger.info("Sending flow add switch")
-        fq_logger.info(str(fc));
+        logging.info("Sending flow add switch")
+        logging.info(str(fc));
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -1922,7 +1917,7 @@
             result = False
 
         self.assertTrue(result, "Flow_add_6 TEST FAILED")
-        fq_logger.info("Flow_add_6 TEST PASSED")
+        logging.info("Flow_add_6 TEST PASSED")
 
 
 # FLOW ADD 7
@@ -1956,12 +1951,12 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Add_7 TEST BEGIN")
+        logging.info("Flow_Add_7 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -1991,8 +1986,8 @@
 
         # Send it to the switch
 
-        fq_logger.info("Sending flow add to switch:")
-        fq_logger.info(str(fc))
+        logging.info("Sending flow add to switch:")
+        logging.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -2012,8 +2007,8 @@
 
         # Send that to the switch
         
-        fq_logger.info("Sending flow add to switch:")
-        fq_logger.info(str(fc2))
+        logging.info("Sending flow add to switch:")
+        logging.info(str(fc2))
         fc2.send_rem = False
         self.assertTrue(sw.flow_add(fc2), "Failed to add flow")
         ft.insert(fc2)
@@ -2038,7 +2033,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Add_7 TEST FAILED")
-        fq_logger.info("Flow_Add_7 TEST PASSED")
+        logging.info("Flow_Add_7 TEST PASSED")
 
 
 # FLOW ADD 8
@@ -2078,12 +2073,12 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Add_8 TEST BEGIN")
+        logging.info("Flow_Add_8 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -2116,8 +2111,8 @@
 
         # Send it to the switch
 
-        fq_logger.info("Sending flow add to switch:")
-        fq_logger.info(str(fc))
+        logging.info("Sending flow add to switch:")
+        logging.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -2139,14 +2134,14 @@
             wn = "OFPFW_NW_DST"
         else:
             wn = all_wildcard_names[w]
-        fq_logger.info("Wildcarding out %s" % (wn))
+        logging.info("Wildcarding out %s" % (wn))
         fc2.match.wildcards = fc2.match.wildcards | w
         fc2 = fc2.canonical()
 
         # Send that to the switch, with overlap checking
         
-        fq_logger.info("Sending flow add to switch:")
-        fq_logger.info(str(fc2))
+        logging.info("Sending flow add to switch:")
+        logging.info(str(fc2))
         fc2.send_rem = False
         self.assertTrue(sw.flow_add(fc2, True), "Failed to add flow")
 
@@ -2172,7 +2167,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Add_8 TEST FAILED")
-        fq_logger.info("Flow_Add_8 TEST PASSED")
+        logging.info("Flow_Add_8 TEST PASSED")
 
 
 # FLOW MODIFY 1
@@ -2205,12 +2200,12 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Mod_1 TEST BEGIN")
+        logging.info("Flow_Mod_1 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -2240,8 +2235,8 @@
 
         # Send it to the switch
 
-        fq_logger.info("Sending flow add to switch:")
-        fq_logger.info(str(fc))
+        logging.info("Sending flow add to switch:")
+        logging.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -2261,8 +2256,8 @@
 
         # Send that to the switch
         
-        fq_logger.info("Sending strict flow mod to switch:")
-        fq_logger.info(str(fc2))
+        logging.info("Sending strict flow mod to switch:")
+        logging.info(str(fc2))
         fc2.send_rem = False
         self.assertTrue(sw.flow_mod(fc2, True), "Failed to modify flow")
         ft.insert(fc2)
@@ -2287,7 +2282,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Mod_1 TEST FAILED")
-        fq_logger.info("Flow_Mod_1 TEST PASSED")
+        logging.info("Flow_Mod_1 TEST PASSED")
 
 
 # FLOW MODIFY 2
@@ -2330,14 +2325,14 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Mod_2 TEST BEGIN")
+        logging.info("Flow_Mod_2 TEST BEGIN")
 
         num_flows = test_param_get(fq_config, "num_flows", 100)
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -2361,10 +2356,10 @@
 
         # Send flow table to switch
 
-        fq_logger.info("Sending flow adds to switch")
+        logging.info("Sending flow adds to switch")
         for fc in ft.values():          # Randomizes order of sending
-            fq_logger.info("Adding flow:")
-            fq_logger.info(str(fc));
+            logging.info("Adding flow:")
+            logging.info(str(fc));
             self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -2426,9 +2421,9 @@
             if n > 1:
                 break
                     
-        fq_logger.info("Modifying %d flows" % (n))
-        fq_logger.info("Sending flow mod to switch:")
-        fq_logger.info(str(mfc))
+        logging.info("Modifying %d flows" % (n))
+        logging.info("Sending flow mod to switch:")
+        logging.info(str(mfc))
         self.assertTrue(sw.flow_mod(mfc, False), "Failed to modify flow")
 
         # Do barrier, to make sure all flows are in
@@ -2454,7 +2449,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Mod_2 TEST FAILED")
-        fq_logger.info("Flow_Mod_2 TEST PASSED")
+        logging.info("Flow_Mod_2 TEST PASSED")
 
 
 # FLOW MODIFY 3
@@ -2483,12 +2478,12 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Mod_3 TEST BEGIN")
+        logging.info("Flow_Mod_3 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -2518,8 +2513,8 @@
 
         # Send it to the switch
 
-        fq_logger.info("Sending flow mod to switch:")
-        fq_logger.info(str(fc))
+        logging.info("Sending flow mod to switch:")
+        logging.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_mod(fc, True), "Failed to modify flows")
@@ -2545,7 +2540,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Mod_3 TEST FAILED")
-        fq_logger.info("Flow_Mod_3 TEST PASSED")
+        logging.info("Flow_Mod_3 TEST PASSED")
 
 
 # FLOW MODIFY 3_1
@@ -2576,12 +2571,12 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Mod_3_1 TEST BEGIN")
+        logging.info("Flow_Mod_3_1 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -2611,8 +2606,8 @@
 
         # Send it to the switch
 
-        fq_logger.info("Sending flow mod to switch:")
-        fq_logger.info(str(fc))
+        logging.info("Sending flow mod to switch:")
+        logging.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_mod(fc, True), "Failed to modify flows")
@@ -2639,8 +2634,8 @@
 
         # Send same flow to the switch again
 
-        fq_logger.info("Sending flow mod to switch:")
-        fq_logger.info(str(fc))
+        logging.info("Sending flow mod to switch:")
+        logging.info(str(fc))
         self.assertTrue(sw.flow_mod(fc, True), "Failed to modify flows")
 
         # Do barrier, to make sure all flows are in
@@ -2660,7 +2655,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Mod_3_1 TEST FAILED")
-        fq_logger.info("Flow_Mod_3_1 TEST PASSED")
+        logging.info("Flow_Mod_3_1 TEST PASSED")
 
 
 # FLOW DELETE 1
@@ -2692,12 +2687,12 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Del_1 TEST BEGIN")
+        logging.info("Flow_Del_1 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -2727,8 +2722,8 @@
 
         # Send it to the switch
 
-        fq_logger.info("Sending flow add to switch:")
-        fq_logger.info(str(fc))
+        logging.info("Sending flow add to switch:")
+        logging.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = False
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -2748,8 +2743,8 @@
 
         # Delete strictly
         
-        fq_logger.info("Sending strict flow del to switch:")
-        fq_logger.info(str(fc2))
+        logging.info("Sending strict flow del to switch:")
+        logging.info(str(fc2))
         self.assertTrue(sw.flow_del(fc2, True), "Failed to delete flow")
         ft.delete(fc)
 
@@ -2773,7 +2768,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Del_1 TEST FAILED")
-        fq_logger.info("Flow_Del_1 TEST PASSED")
+        logging.info("Flow_Del_1 TEST PASSED")
 
 
 # FLOW DELETE 2
@@ -2814,14 +2809,14 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Del_2 TEST BEGIN")
+        logging.info("Flow_Del_2 TEST BEGIN")
 
         num_flows = test_param_get(fq_config, "num_flows", 100)
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -2845,10 +2840,10 @@
 
         # Send flow table to switch
 
-        fq_logger.info("Sending flow adds to switch")
+        logging.info("Sending flow adds to switch")
         for fc in ft.values():          # Randomizes order of sending
-            fq_logger.info("Adding flow:")
-            fq_logger.info(str(fc));
+            logging.info("Adding flow:")
+            logging.info(str(fc));
             self.assertTrue(sw.flow_add(fc), "Failed to add flow")
 
         # Do barrier, to make sure all flows are in
@@ -2910,9 +2905,9 @@
             if n > 1:
                 break
                     
-        fq_logger.info("Deleting %d flows" % (n))
-        fq_logger.info("Sending flow del to switch:")
-        fq_logger.info(str(dfc))
+        logging.info("Deleting %d flows" % (n))
+        logging.info("Sending flow del to switch:")
+        logging.info(str(dfc))
         self.assertTrue(sw.flow_del(dfc, False), "Failed to delete flows")
 
         # Do barrier, to make sure all flows are in
@@ -2938,7 +2933,7 @@
             result = False
 
         self.assertTrue(result, "Flow_Del_2 TEST FAILED")
-        fq_logger.info("Flow_Del_2 TEST PASSED")
+        logging.info("Flow_Del_2 TEST PASSED")
 
 
 # FLOW DELETE 4
@@ -2973,12 +2968,12 @@
     """
 
     def runTest(self):
-        fq_logger.info("Flow_Del_4 TEST BEGIN")
+        logging.info("Flow_Del_4 TEST BEGIN")
 
         # Clear all flows from switch
 
-        fq_logger.info("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, fq_logger)
+        logging.info("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # Get switch capabilites
@@ -3008,8 +3003,8 @@
 
         # Send it to the switch. with "notify on removed"
 
-        fq_logger.info("Sending flow add to switch:")
-        fq_logger.info(str(fc))
+        logging.info("Sending flow add to switch:")
+        logging.info(str(fc))
         ft = Flow_Tbl()
         fc.send_rem = True
         self.assertTrue(sw.flow_add(fc), "Failed to add flow")
@@ -3029,8 +3024,8 @@
 
         # Delete strictly
         
-        fq_logger.info("Sending strict flow del to switch:")
-        fq_logger.info(str(fc2))
+        logging.info("Sending strict flow del to switch:")
+        logging.info(str(fc2))
         self.assertTrue(sw.flow_del(fc2, True), "Failed to delete flow")
         ft.delete(fc)
 
@@ -3057,5 +3052,5 @@
             result = False
 
         self.assertTrue(result, "Flow_Del_4 TEST FAILED")
-        fq_logger.info("Flow_Del_4 TEST PASSED")
+        logging.info("Flow_Del_4 TEST PASSED")
         
diff --git a/tests/flow_stats.py b/tests/flow_stats.py
index 8ff8b69..ecc8157 100644
--- a/tests/flow_stats.py
+++ b/tests/flow_stats.py
@@ -23,8 +23,6 @@
 #@var fs_port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 fs_port_map = None
-#@var fs_logger Local logger object
-fs_logger = None
 #@var fs_config Local copy of global configuration data
 fs_config = None
 
@@ -54,17 +52,14 @@
     basic.test_set_init(config)
 
     global fs_port_map
-    global fs_logger
     global fs_config
 
-    fs_logger = logging.getLogger("flow_stats")
-    fs_logger.info("Initializing test set")
     fs_port_map = config["port_map"]
     fs_config = config
 
 def sendPacket(obj, pkt, ingress_port, egress_port, test_timeout):
 
-    fs_logger.info("Sending packet to dp port " + str(ingress_port) +
+    logging.info("Sending packet to dp port " + str(ingress_port) +
                    ", expecting output on " + str(egress_port))
     obj.dataplane.send(ingress_port, str(pkt))
 
@@ -78,7 +73,7 @@
                                                        exp_pkt=exp_pkt_arg)
     obj.assertTrue(rcv_pkt is not None,
                    "Packet not received on port " + str(egress_port))
-    fs_logger.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
+    logging.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
                     str(rcv_port))
     obj.assertEqual(rcv_port, egress_port,
                     "Packet received on port " + str(rcv_port) +
@@ -105,7 +100,7 @@
 
         all_packets_received = 0
         for i in range(0,test_timeout):
-            fs_logger.info("Sending stats request")
+            logging.info("Sending stats request")
             response, pkt = self.controller.transact(stat_req,
                                                      timeout=test_timeout)
             self.assertTrue(response is not None, 
@@ -119,7 +114,7 @@
                 #obj.match.pad2 = [0, 0]
                 #self.assertEqual(match, obj.match,
                 #                 "Matches do not match")
-                fs_logger.info("Received " + str(obj.packet_count) + " packets")
+                logging.info("Received " + str(obj.packet_count) + " packets")
                 if obj.packet_count == packet_count:
                     all_packets_received = 1
 
@@ -140,7 +135,7 @@
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
-        rc = delete_all_flows(self.controller, fs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # build packet
@@ -154,7 +149,7 @@
         # build flow
         ingress_port = of_ports[0];
         egress_port = of_ports[1];
-        fs_logger.info("Ingress " + str(ingress_port) + 
+        logging.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
         match.in_port = ingress_port
         flow_mod_msg = message.flow_mod()
@@ -167,7 +162,7 @@
         self.assertTrue(flow_mod_msg.actions.add(act), "Could not add action")
        
         # send flow
-        fs_logger.info("Inserting flow")
+        logging.info("Inserting flow")
         rv = self.controller.message_send(flow_mod_msg)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
@@ -177,7 +172,7 @@
 
         # send packet N times
         num_sends = random.randint(10,20)
-        fs_logger.info("Sending " + str(num_sends) + " test packets")
+        logging.info("Sending " + str(num_sends) + " test packets")
         for i in range(0,num_sends):
             sendPacket(self, pkt, ingress_port, egress_port,
                        test_timeout)
@@ -219,7 +214,7 @@
         act.port = egress_port
         self.assertTrue(flow_mod_msg.actions.add(act), "Could not add action")
 
-        fs_logger.info("Ingress " + str(ingress_port) + 
+        logging.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
 
         return flow_mod_msg
@@ -233,7 +228,7 @@
             #obj.match.pad2 = [0, 0]
             #self.assertEqual(match, obj.match,
             #                 "Matches do not match")
-           fs_logger.info("Received " + str(obj.packet_count)
+           logging.info("Received " + str(obj.packet_count)
                           + " packets")
            total_packets += obj.packet_count
         return total_packets
@@ -246,7 +241,7 @@
 
         all_packets_received = 0
         for i in range(0,test_timeout):
-            fs_logger.info("Sending stats request")
+            logging.info("Sending stats request")
             # TODO: move REPLY_MORE handling to controller.transact?
             response, pkt = self.controller.transact(stat_req,
                                                      timeout=test_timeout)
@@ -282,7 +277,7 @@
         egress_port1 = of_ports[1];
         egress_port2 = of_ports[2];
 
-        rc = delete_all_flows(self.controller, fs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         pkt1 = simple_tcp_packet()
@@ -291,31 +286,31 @@
         pkt2 = simple_tcp_packet(dl_src='0:7:7:7:7:7')
         flow_mod_msg2 = self.buildFlowModMsg(pkt2, ingress_port, egress_port2)
        
-        fs_logger.info("Inserting flow1")
+        logging.info("Inserting flow1")
         rv = self.controller.message_send(flow_mod_msg1)
         self.assertTrue(rv != -1, "Error installing flow mod")
-        fs_logger.info("Inserting flow2")
+        logging.info("Inserting flow2")
         rv = self.controller.message_send(flow_mod_msg2)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
         num_pkt1s = random.randint(10,30)
-        fs_logger.info("Sending " + str(num_pkt1s) + " pkt1s")
+        logging.info("Sending " + str(num_pkt1s) + " pkt1s")
         num_pkt2s = random.randint(10,30)
-        fs_logger.info("Sending " + str(num_pkt2s) + " pkt2s")
+        logging.info("Sending " + str(num_pkt2s) + " pkt2s")
         for i in range(0,num_pkt1s):
             sendPacket(self, pkt1, ingress_port, egress_port1, test_timeout)
         for i in range(0,num_pkt2s):
             sendPacket(self, pkt2, ingress_port, egress_port2, test_timeout)
             
         match1 = packet_to_flow_match(self, pkt1)
-        fs_logger.info("Verifying flow1's " + str(num_pkt1s) + " packets")
+        logging.info("Verifying flow1's " + str(num_pkt1s) + " packets")
         self.verifyStats(match1, ofp.OFPP_NONE, test_timeout, num_pkt1s)
         match2 = packet_to_flow_match(self, pkt2)
-        fs_logger.info("Verifying flow2's " + str(num_pkt2s) + " packets")
+        logging.info("Verifying flow2's " + str(num_pkt2s) + " packets")
         self.verifyStats(match2, ofp.OFPP_NONE, test_timeout, num_pkt2s)
         match1.wildcards |= ofp.OFPFW_DL_SRC
-        fs_logger.info("Verifying combined " + str(num_pkt1s+num_pkt2s) + " packets")
+        logging.info("Verifying combined " + str(num_pkt1s+num_pkt2s) + " packets")
         self.verifyStats(match1, ofp.OFPP_NONE, test_timeout, 
                          num_pkt1s+num_pkt2s)
         # TODO: sweep through the wildcards to verify matching?
@@ -349,7 +344,7 @@
         act.port = egress_port
         self.assertTrue(flow_mod_msg.actions.add(act), "Could not add action")
 
-        fs_logger.info("Ingress " + str(ingress_port) + 
+        logging.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
 
         return flow_mod_msg
@@ -363,7 +358,7 @@
 
         all_packets_received = 0
         for i in range(0,test_timeout):
-            fs_logger.info("Sending stats request")
+            logging.info("Sending stats request")
             response, pkt = self.controller.transact(stat_req,
                                                      timeout=test_timeout)
             self.assertTrue(response is not None, 
@@ -374,7 +369,7 @@
                 self.assertTrue(obj.flow_count == flow_count,
                                 "Flow count " + str(obj.flow_count) +
                                 " does not match expected " + str(flow_count))
-                fs_logger.info("Received " + str(obj.packet_count) + " packets")
+                logging.info("Received " + str(obj.packet_count) + " packets")
                 if obj.packet_count == packet_count:
                     all_packets_received = 1
 
@@ -398,7 +393,7 @@
         egress_port1 = of_ports[1];
         egress_port2 = of_ports[2];
 
-        rc = delete_all_flows(self.controller, fs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         pkt1 = simple_tcp_packet()
@@ -407,18 +402,18 @@
         pkt2 = simple_tcp_packet(dl_src='0:7:7:7:7:7')
         flow_mod_msg2 = self.buildFlowModMsg(pkt2, ingress_port, egress_port2)
        
-        fs_logger.info("Inserting flow1")
+        logging.info("Inserting flow1")
         rv = self.controller.message_send(flow_mod_msg1)
         self.assertTrue(rv != -1, "Error installing flow mod")
-        fs_logger.info("Inserting flow2")
+        logging.info("Inserting flow2")
         rv = self.controller.message_send(flow_mod_msg2)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
         num_pkt1s = random.randint(10,30)
-        fs_logger.info("Sending " + str(num_pkt1s) + " pkt1s")
+        logging.info("Sending " + str(num_pkt1s) + " pkt1s")
         num_pkt2s = random.randint(10,30)
-        fs_logger.info("Sending " + str(num_pkt2s) + " pkt2s")
+        logging.info("Sending " + str(num_pkt2s) + " pkt2s")
         for i in range(0,num_pkt1s):
             sendPacket(self, pkt1, ingress_port, egress_port1, test_timeout)
         for i in range(0,num_pkt2s):
diff --git a/tests/load.py b/tests/load.py
index d09608e..dadb42f 100644
--- a/tests/load.py
+++ b/tests/load.py
@@ -36,8 +36,6 @@
 #@var load_port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 load_port_map = None
-#@var load_logger Local logger object
-load_logger = None
 #@var load_config Local copy of global configuration data
 load_config = None
 
@@ -54,11 +52,8 @@
     """
 
     global load_port_map
-    global load_logger
     global load_config
 
-    load_logger = logging.getLogger("load")
-    load_logger.info("Initializing test set")
     load_port_map = config["port_map"]
     load_config = config
 
@@ -114,20 +109,20 @@
         act = action.action_output()
         act.port = lb_port + 1
         self.assertTrue(msg.actions.add(act), 'Could not add action to msg')
-        load_logger.info("Sleeping before starting storm")
+        logging.info("Sleeping before starting storm")
         time.sleep(1) # Root causing issue with fast disconnects
-        load_logger.info("Sending packet out to %d" % (lb_port + 1))
+        logging.info("Sending packet out to %d" % (lb_port + 1))
         rv = self.controller.message_send(msg)
         self.assertTrue(rv == 0, "Error sending out message")
 
         for idx in range(0, barrier_count):
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
             # To do:  Add some interesting functionality here
-            load_logger.info("Barrier %d completed" % idx)
+            logging.info("Barrier %d completed" % idx)
 
         # Clear the flow table when done
-        load_logger.debug("Deleting all flows from switch")
-        rc = delete_all_flows(self.controller, load_logger)
+        logging.debug("Deleting all flows from switch")
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
 # Do not run by default; still mysterious disconnects often
diff --git a/tests/openflow_protocol_messages.py b/tests/openflow_protocol_messages.py
index c8ad1b8..5f29da5 100644
--- a/tests/openflow_protocol_messages.py
+++ b/tests/openflow_protocol_messages.py
@@ -24,7 +24,6 @@
 
 
 of_port_map = None
-of_logger = None
 of_config = None
 
 def test_set_init(config):
@@ -33,11 +32,8 @@
     basic.test_set_init(config)
 
     global of_port_map
-    global of_logger
     global of_config
 
-    of_logger = logging.getLogger("Start Openflow_Protocol_Messages Conformance Test-suite")
-    of_logger.info("Initializing test set")
     of_port_map = config["port_map"]
     of_config = config
 
@@ -49,17 +45,17 @@
 	b) Verify OFPT_FEATURES_REPLY is received without errors"""
 
     def runTest(self):
-        of_logger.info("Running Features_Request test")
+        logging.info("Running Features_Request test")
         
         of_ports = of_port_map.keys()
         of_ports.sort()
         
         #Clear switch state
-        rc = delete_all_flows(self.controller, of_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
         
-        of_logger.info("Sending Features_Request")
-        of_logger.info("Expecting Features_Reply")
+        logging.info("Sending Features_Request")
+        logging.info("Expecting Features_Reply")
 
         request = message.features_request()
         rv = self.controller.message_send(request)
@@ -79,17 +75,17 @@
 
     def runTest(self):
 
-        of_logger.info("Running Configuration_Request test ")
+        logging.info("Running Configuration_Request test ")
         
         of_ports = of_port_map.keys()
         of_ports.sort()
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, of_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        of_logger.info("Sending OFPT_GET_CONFIG_REQUEST ")
-        of_logger.info("Expecting OFPT_GET_CONFIG_REPLY ")
+        logging.info("Sending OFPT_GET_CONFIG_REQUEST ")
+        logging.info("Expecting OFPT_GET_CONFIG_REPLY ")
 
         request = message.get_config_request()
         rv = self.controller.message_send(request)
@@ -108,17 +104,17 @@
 
     def runTest(self):
 
-        of_logger.info("Running Modify_State_Add test")
+        logging.info("Running Modify_State_Add test")
 
         of_ports = of_port_map.keys()
         of_ports.sort()
         
         #Clear switch state
-        rc = delete_all_flows(self.controller,of_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        of_logger.info("Inserting a flow entry")
-        of_logger.info("Expecting active_count=1 in table_stats_reply")
+        logging.info("Inserting a flow entry")
+        logging.info("Expecting active_count=1 in table_stats_reply")
 
         #Insert a flow entry matching on ingress_port
         (Pkt,match) = Wildcard_All_Except_Ingress(self,of_ports)
@@ -137,17 +133,17 @@
 
     def runTest(self):
 
-        of_logger.info("Running Modify_State_Delete test")
+        logging.info("Running Modify_State_Delete test")
 
         of_ports = of_port_map.keys()
         of_ports.sort()
 
         #Clear switch state
-        rc = delete_all_flows(self.controller,of_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        of_logger.info("Inserting a flow entry and then deleting it")
-        of_logger.info("Expecting the active_count=0 in table_stats_reply")
+        logging.info("Inserting a flow entry and then deleting it")
+        logging.info("Expecting the active_count=0 in table_stats_reply")
 
         #Insert a flow matching on ingress_port 
         (Pkt,match) = Wildcard_All_Except_Ingress(self,of_ports)
@@ -172,17 +168,17 @@
 
     def runTest(self):
 
-        of_logger.info("Running Modify_State_Modify test")
+        logging.info("Running Modify_State_Modify test")
 
         of_ports = of_port_map.keys()
         of_ports.sort()
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, of_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        of_logger.info("Inserting a flow entry and then modifying it")
-        of_logger.info("Expecting the Test Packet to implement the modified action")
+        logging.info("Inserting a flow entry and then modifying it")
+        logging.info("Expecting the Test Packet to implement the modified action")
 
         # Insert a flow matching on ingress_port with action A (output to of_port[1])    
         (pkt,match) = Wildcard_All_Except_Ingress(self,of_ports)
@@ -203,17 +199,17 @@
 
     def runTest(self):
 
-        of_logger.info("Running Read_State test")
+        logging.info("Running Read_State test")
 
         of_ports = of_port_map.keys()
         of_ports.sort()
 
         #Clear switch state
-        rc = delete_all_flows(self.controller, of_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        of_logger.info("Inserting a flow entry and then sending flow_stats request")
-        of_logger.info("Expecting the a flow_stats_reply without errors")
+        logging.info("Inserting a flow entry and then sending flow_stats request")
+        logging.info("Expecting the a flow_stats_reply without errors")
 
         # Insert a flow with match on ingress_port
         (pkt,match ) = Wildcard_All_Except_Ingress(self,of_ports)
@@ -229,17 +225,17 @@
     
     def runTest(self):
 
-        of_logger.info("Running Packet_Out test")
+        logging.info("Running Packet_Out test")
 
         of_ports = of_port_map.keys()
         of_ports.sort()
        
         #Clear Switch state
-        rc = delete_all_flows(self.controller, of_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
-        of_logger.info("Sending a packet-out for each dataplane port")
-        of_logger.info("Expecting the packet on appropriate dataplane port")
+        logging.info("Sending a packet-out for each dataplane port")
+        logging.info("Expecting the packet on appropriate dataplane port")
 
         for dp_port in of_ports:
             for outpkt, opt in [
@@ -253,7 +249,7 @@
                 act.port = dp_port
                 self.assertTrue(msg.actions.add(act), 'Could not add action to msg')
 
-                of_logger.info("PacketOut to: " + str(dp_port))
+                logging.info("PacketOut to: " + str(dp_port))
                 rv = self.controller.message_send(msg)
                 self.assertTrue(rv == 0, "Error sending out message")
 
@@ -267,12 +263,12 @@
                                                                 exp_pkt=exp_pkt_arg)
                 
                 self.assertTrue(pkt is not None, 'Packet not received')
-                of_logger.info("PacketOut: got pkt from " + str(of_port))
+                logging.info("PacketOut: got pkt from " + str(of_port))
                 if of_port is not None:
                     self.assertEqual(of_port, dp_port, "Unexpected receive port")
                 if not dataplane.match_exp_pkt(outpkt, pkt):
-                    of_logger.debug("Sent %s" % format_packet(outpkt))
-                    of_logger.debug("Resp %s" % format_packet(
+                    logging.debug("Sent %s" % format_packet(outpkt))
+                    logging.debug("Resp %s" % format_packet(
                             str(pkt)[:len(str(outpkt))]))
                 self.assertEqual(str(outpkt), str(pkt)[:len(str(outpkt))],
                                     'Response packet does not match send packet')
@@ -286,24 +282,24 @@
     
     def runTest(self):
         
-        of_logger.info("Running Packet_In test")
+        logging.info("Running Packet_In test")
 
         of_ports = of_port_map.keys()
         of_ports.sort()
         ingress_port = of_ports[0]
 
         #Clear Switch state
-        rc = delete_all_flows(self.controller, of_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-        of_logger.info("Sending a Simple tcp packet a dataplane port")
-        of_logger.info("Expecting a packet_in event on the control plane")
+        logging.info("Sending a Simple tcp packet a dataplane port")
+        logging.info("Expecting a packet_in event on the control plane")
 
         # Send  packet on dataplane port and verify packet_in event gets generated.
         pkt = simple_tcp_packet()
         self.dataplane.send(ingress_port, str(pkt))
-        of_logger.info("Sending packet to dp port " + str(ingress_port) +
+        logging.info("Sending packet to dp port " + str(ingress_port) +
                    ", expecting packet_in on control plane" )
       
         (response, pkt) = self.controller.poll(exp_msg=ofp.OFPT_PACKET_IN,
@@ -321,10 +317,10 @@
 
     def runTest(self):
         
-        of_logger.info("Running Hello test")
+        logging.info("Running Hello test")
 
-        of_logger.info("Sending Hello")
-        of_logger.info("Expecting a Hello on the control plane with version--1.0.0")
+        logging.info("Sending Hello")
+        logging.info("Expecting a Hello on the control plane with version--1.0.0")
         
         #Send Hello message
         request = message.hello()
@@ -344,10 +340,10 @@
     
     def runTest(self):
 
-        of_logger.info("Running Echo_Without_Body test")
+        logging.info("Running Echo_Without_Body test")
 
-        of_logger.info("Sending Echo Request")
-        of_logger.info("Expecting a Echo Reply with version--1.0.0 and same xid")
+        logging.info("Sending Echo Request")
+        logging.info("Expecting a Echo Reply with version--1.0.0 and same xid")
 
         # Send echo_request
         request = message.echo_request()
@@ -367,10 +363,10 @@
     
     def runTest(self):
 
-        of_logger.info("Running Barrier_Request_Reply test")
+        logging.info("Running Barrier_Request_Reply test")
 
-        of_logger.info("Sending Barrier Request")
-        of_logger.info("Expecting a Barrier Reply with same xid")
+        logging.info("Sending Barrier Request")
+        logging.info("Expecting a Barrier Reply with same xid")
 
         #Send Barrier Request
         request = message.barrier_request()
diff --git a/tests/pktact.py b/tests/pktact.py
index fd1b014..ef7505e 100644
--- a/tests/pktact.py
+++ b/tests/pktact.py
@@ -35,8 +35,6 @@
 #@var port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 pa_port_map = None
-#@var pa_logger Local logger object
-pa_logger = None
 #@var pa_config Local copy of global configuration data
 pa_config = None
 
@@ -100,11 +98,8 @@
     basic.test_set_init(config)
 
     global pa_port_map
-    global pa_logger
     global pa_config
 
-    pa_logger = logging.getLogger("pkt_act")
-    pa_logger.info("Initializing test set")
     pa_port_map = config["port_map"]
     pa_config = config
 
@@ -137,12 +132,12 @@
         act = action.action_output()
 
         for idx in range(len(of_ports)):
-            rv = delete_all_flows(self.controller, pa_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
             ingress_port = of_ports[idx]
             egress_port = of_ports[(idx + 1) % len(of_ports)]
-            pa_logger.info("Ingress " + str(ingress_port) + 
+            logging.info("Ingress " + str(ingress_port) + 
                              " to egress " + str(egress_port))
 
             match.in_port = ingress_port
@@ -154,12 +149,12 @@
             act.port = egress_port
             self.assertTrue(request.actions.add(act), "Could not add action")
 
-            pa_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + 
+            logging.info("Sending packet to dp port " + 
                            str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
 
@@ -172,7 +167,7 @@
             (rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(port_number=exp_port,
                                                                 exp_pkt=exp_pkt_arg)
             self.assertTrue(rcv_pkt is not None, "Did not receive packet")
-            pa_logger.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
+            logging.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
                          str(rcv_port))
             self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
             self.assertEqual(str(pkt), str(rcv_pkt),
@@ -206,7 +201,7 @@
                         "Could not generate flow match from pkt")
         act = action.action_output()
 
-        rv = delete_all_flows(self.controller, pa_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
         ingress_port = of_ports[0]
@@ -220,12 +215,12 @@
         act.max_len = 65535
         self.assertTrue(request.actions.add(act), "Could not add action")
 
-        pa_logger.info("Inserting flow")
+        logging.info("Inserting flow")
         rv = self.controller.message_send(request)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-        pa_logger.info("Sending packet to dp port " +
+        logging.info("Sending packet to dp port " +
                         str(ingress_port))
         self.dataplane.send(ingress_port, str(pkt))
 
@@ -234,8 +229,8 @@
         self.assertTrue(response is not None,
                         'Packet in message not received by controller')
         if not dataplane.match_exp_pkt(pkt, response.data):
-            pa_logger.debug("Sent %s" % format_packet(pkt))
-            pa_logger.debug("Resp %s" % format_packet(response.data))
+            logging.debug("Sent %s" % format_packet(pkt))
+            logging.debug("Resp %s" % format_packet(response.data))
             self.assertTrue(False,
                             'Response packet does not match send packet' +
                              ' for controller port')
@@ -291,12 +286,12 @@
             egress_port = of_ports[(idx + 1) % len(of_ports)]
 
             for egress_queue_id in self.portQueuesGet(queue_stats, egress_port):
-                pa_logger.info("Ingress " + str(ingress_port)
+                logging.info("Ingress " + str(ingress_port)
                                + " to egress " + str(egress_port)
                                + " queue " + str(egress_queue_id)
                                )
 
-                rv = delete_all_flows(self.controller, pa_logger)
+                rv = delete_all_flows(self.controller)
                 self.assertEqual(rv, 0, "Failed to delete all flows")
 
                 match.in_port = ingress_port
@@ -309,7 +304,7 @@
                 act.queue_id = egress_queue_id
                 self.assertTrue(request.actions.add(act), "Could not add action")
 
-                pa_logger.info("Inserting flow")
+                logging.info("Inserting flow")
                 rv = self.controller.message_send(request)
                 self.assertTrue(rv != -1, "Error installing flow mod")
                 self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
@@ -322,7 +317,7 @@
                 (qs_before, p) = self.controller.transact(request)
                 self.assertNotEqual(qs_before, None, "Queue stats request failed")
 
-                pa_logger.info("Sending packet to dp port " + 
+                logging.info("Sending packet to dp port " + 
                                str(ingress_port))
                 self.dataplane.send(ingress_port, str(pkt))
                 
@@ -335,7 +330,7 @@
                     (rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(port_number=exp_port,
                                                                         exp_pkt=exp_pkt_arg)
                     self.assertTrue(rcv_pkt is not None, "Did not receive packet")
-                    pa_logger.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
+                    logging.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
                                     str(rcv_port))
                     self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
                     self.assertEqual(str(pkt), str(rcv_pkt),
@@ -414,17 +409,17 @@
             ingress_port = of_ports[idx]
             egress_port = ofp.OFPP_CONTROLLER
 
-            pa_logger.info("Ingress port " + str(ingress_port)
+            logging.info("Ingress port " + str(ingress_port)
                            + ", controller port queues " 
                            + str(self.portQueuesGet(queue_stats, egress_port)))
 
             for egress_queue_id in self.portQueuesGet(queue_stats, egress_port):
-                pa_logger.info("Ingress " + str(ingress_port)
+                logging.info("Ingress " + str(ingress_port)
                                + " to egress " + str(egress_port)
                                + " queue " + str(egress_queue_id)
                                )
 
-                rv = delete_all_flows(self.controller, pa_logger)
+                rv = delete_all_flows(self.controller)
                 self.assertEqual(rv, 0, "Failed to delete all flows")
 
                 match.in_port = ingress_port
@@ -437,7 +432,7 @@
                 act.queue_id = egress_queue_id
                 self.assertTrue(request.actions.add(act), "Could not add action")
 
-                pa_logger.info("Inserting flow")
+                logging.info("Inserting flow")
                 rv = self.controller.message_send(request)
                 self.assertTrue(rv != -1, "Error installing flow mod")
                 self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
@@ -450,7 +445,7 @@
                 (qs_before, p) = self.controller.transact(request)
                 self.assertNotEqual(qs_before, None, "Queue stats request failed")
 
-                pa_logger.info("Sending packet to dp port " + 
+                logging.info("Sending packet to dp port " + 
                                str(ingress_port))
                 self.dataplane.send(ingress_port, str(pkt))
                 
@@ -472,8 +467,8 @@
                 self.assertTrue(response is not None, 
                                'Packet in message not received by controller')
                 if not dataplane.match_exp_pkt(pkt, response.data):
-                    basic_logger.debug("Sent %s" % format_packet(pkt))
-                    basic_logger.debug("Resp %s" % format_packet(response.data))
+                    logging.debug("Sent %s" % format_packet(pkt))
+                    logging.debug("Resp %s" % format_packet(response.data))
                     self.assertTrue(False,
                                     'Response packet does not match send packet' +
                                     ' for controller port')
@@ -537,13 +532,13 @@
         act = action.action_output()
 
         for idx in range(len(of_ports)):
-            rv = delete_all_flows(self.controller, pa_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
             ingress_port = of_ports[idx]
             egress_port1 = of_ports[(idx + 1) % len(of_ports)]
             egress_port2 = of_ports[(idx + 2) % len(of_ports)]
-            pa_logger.info("Ingress " + str(ingress_port) + 
+            logging.info("Ingress " + str(ingress_port) + 
                            " to egress " + str(egress_port1) + " and " +
                            str(egress_port2))
 
@@ -556,21 +551,21 @@
             self.assertTrue(request.actions.add(act), "Could not add action1")
             act.port = egress_port2
             self.assertTrue(request.actions.add(act), "Could not add action2")
-            # pa_logger.info(request.show())
+            # logging.info(request.show())
 
-            pa_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + 
+            logging.info("Sending packet to dp port " + 
                            str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
             yes_ports = set([egress_port1, egress_port2])
             no_ports = set(of_ports).difference(yes_ports)
 
             receive_pkt_check(self.dataplane, pkt, yes_ports, no_ports,
-                              self, pa_logger, pa_config)
+                              self, pa_config)
 
 class DirectMCNonIngress(basic.SimpleDataPlane):
     """
@@ -597,10 +592,10 @@
         act = action.action_output()
 
         for ingress_port in of_ports:
-            rv = delete_all_flows(self.controller, pa_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
-            pa_logger.info("Ingress " + str(ingress_port) + 
+            logging.info("Ingress " + str(ingress_port) + 
                            " all non-ingress ports")
             match.in_port = ingress_port
 
@@ -613,18 +608,18 @@
                 act.port = egress_port
                 self.assertTrue(request.actions.add(act), 
                                 "Could not add output to " + str(egress_port))
-            pa_logger.debug(request.show())
+            logging.debug(request.show())
 
-            pa_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
             yes_ports = set(of_ports).difference([ingress_port])
             receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
-                              self, pa_logger, pa_config)
+                              self, pa_config)
 
 
 class DirectMC(basic.SimpleDataPlane):
@@ -652,10 +647,10 @@
         act = action.action_output()
 
         for ingress_port in of_ports:
-            rv = delete_all_flows(self.controller, pa_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
-            pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+            logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
             request = message.flow_mod()
@@ -668,17 +663,16 @@
                     act.port = egress_port
                 self.assertTrue(request.actions.add(act), 
                                 "Could not add output to " + str(egress_port))
-            # pa_logger.info(request.show())
+            # logging.info(request.show())
 
-            pa_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
-            receive_pkt_check(self.dataplane, pkt, of_ports, [], self,
-                              pa_logger, pa_config)
+            receive_pkt_check(self.dataplane, pkt, of_ports, [], self, pa_config)
 
 class Flood(basic.SimpleDataPlane):
     """
@@ -703,10 +697,10 @@
         act = action.action_output()
 
         for ingress_port in of_ports:
-            rv = delete_all_flows(self.controller, pa_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
-            pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+            logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
             request = message.flow_mod()
@@ -715,18 +709,18 @@
             act.port = ofp.OFPP_FLOOD
             self.assertTrue(request.actions.add(act), 
                             "Could not add flood port action")
-            pa_logger.info(request.show())
+            logging.info(request.show())
 
-            pa_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
             yes_ports = set(of_ports).difference([ingress_port])
             receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
-                              self, pa_logger, pa_config)
+                              self, pa_config)
 
 class FloodPlusIngress(basic.SimpleDataPlane):
     """
@@ -752,10 +746,10 @@
         act = action.action_output()
 
         for ingress_port in of_ports:
-            rv = delete_all_flows(self.controller, pa_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
-            pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+            logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
             request = message.flow_mod()
@@ -767,17 +761,16 @@
             act.port = ofp.OFPP_IN_PORT
             self.assertTrue(request.actions.add(act), 
                             "Could not add ingress port for output")
-            pa_logger.info(request.show())
+            logging.info(request.show())
 
-            pa_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
-            receive_pkt_check(self.dataplane, pkt, of_ports, [], self,
-                              pa_logger, pa_config)
+            receive_pkt_check(self.dataplane, pkt, of_ports, [], self, pa_config)
 
 class All(basic.SimpleDataPlane):
     """
@@ -802,10 +795,10 @@
         act = action.action_output()
 
         for ingress_port in of_ports:
-            rv = delete_all_flows(self.controller, pa_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
-            pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+            logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
             request = message.flow_mod()
@@ -814,18 +807,18 @@
             act.port = ofp.OFPP_ALL
             self.assertTrue(request.actions.add(act), 
                             "Could not add ALL port action")
-            pa_logger.info(request.show())
+            logging.info(request.show())
 
-            pa_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
             yes_ports = set(of_ports).difference([ingress_port])
             receive_pkt_check(self.dataplane, pkt, yes_ports, [ingress_port],
-                              self, pa_logger, pa_config)
+                              self, pa_config)
 
 class AllPlusIngress(basic.SimpleDataPlane):
     """
@@ -851,10 +844,10 @@
         act = action.action_output()
 
         for ingress_port in of_ports:
-            rv = delete_all_flows(self.controller, pa_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
-            pa_logger.info("Ingress " + str(ingress_port) + " to all ports")
+            logging.info("Ingress " + str(ingress_port) + " to all ports")
             match.in_port = ingress_port
 
             request = message.flow_mod()
@@ -866,17 +859,16 @@
             act.port = ofp.OFPP_IN_PORT
             self.assertTrue(request.actions.add(act), 
                             "Could not add ingress port for output")
-            pa_logger.info(request.show())
+            logging.info(request.show())
 
-            pa_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
-            receive_pkt_check(self.dataplane, pkt, of_ports, [], self,
-                              pa_logger, pa_config)
+            receive_pkt_check(self.dataplane, pkt, of_ports, [], self, pa_config)
             
 class FloodMinusPort(basic.SimpleDataPlane):
     """
@@ -903,15 +895,14 @@
         act = action.action_output()
 
         for idx in range(len(of_ports)):
-            rv = delete_all_flows(self.controller, pa_logger)
+            rv = delete_all_flows(self.controller)
             self.assertEqual(rv, 0, "Failed to delete all flows")
 
             ingress_port = of_ports[idx]
             no_flood_idx = (idx + 1) % len(of_ports)
             no_flood_port = of_ports[no_flood_idx]
             rv = port_config_set(self.controller, no_flood_port,
-                                 ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD,
-                                 pa_logger)
+                                 ofp.OFPPC_NO_FLOOD, ofp.OFPPC_NO_FLOOD)
             self.assertEqual(rv, 0, "Failed to set port config")
 
             match.in_port = ingress_port
@@ -922,24 +913,23 @@
             act.port = ofp.OFPP_FLOOD
             self.assertTrue(request.actions.add(act), 
                             "Could not add flood port action")
-            pa_logger.info(request.show())
+            logging.info(request.show())
 
-            pa_logger.info("Inserting flow")
+            logging.info("Inserting flow")
             rv = self.controller.message_send(request)
             self.assertTrue(rv != -1, "Error installing flow mod")
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + str(ingress_port))
-            pa_logger.info("No flood port is " + str(no_flood_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("No flood port is " + str(no_flood_port))
             self.dataplane.send(ingress_port, str(pkt))
             no_ports = set([ingress_port, no_flood_port])
             yes_ports = set(of_ports).difference(no_ports)
-            receive_pkt_check(self.dataplane, pkt, yes_ports, no_ports, self,
-                              pa_logger, pa_config)
+            receive_pkt_check(self.dataplane, pkt, yes_ports, no_ports, self, pa_config)
 
             # Turn no flood off again
             rv = port_config_set(self.controller, no_flood_port,
-                                 0, ofp.OFPPC_NO_FLOOD, pa_logger)
+                                 0, ofp.OFPPC_NO_FLOOD)
             self.assertEqual(rv, 0, "Failed to reset port config")
 
             #@todo Should check no other packets received
@@ -951,9 +941,8 @@
 class BaseMatchCase(basic.SimpleDataPlane):
     def setUp(self):
         basic.SimpleDataPlane.setUp(self)
-        self.logger = pa_logger
     def runTest(self):
-        self.logger.info("BaseMatchCase")
+        logging.info("BaseMatchCase")
 
 class ExactMatch(BaseMatchCase):
     """
@@ -1004,7 +993,7 @@
         self.flowMsgs = {}
 
     def _ClearTable(self):
-        rc = delete_all_flows(self.controller, self.logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
@@ -1039,7 +1028,7 @@
             self._ClearTable()
 
         # Sanity check flow at lower priority from pA to pB
-        self.logger.info("runPrioFlows(pA=%d,pB=%d,pC=%d,ph=%d,pl=%d"
+        logging.info("runPrioFlows(pA=%d,pB=%d,pC=%d,ph=%d,pl=%d"
                          % (portA, portB, portC, prioHigher, prioLower))
 
         # Sanity check flow at lower priority from pA to pC
@@ -1072,7 +1061,7 @@
                                   wildcards=wildcards,
                                   egr_ports=egp)
         request.priority = prio
-        self.logger.debug("Install flow with priority " + str(prio))
+        logging.debug("Install flow with priority " + str(prio))
         flow_msg_install(self, request, clear_table_override=False)
         self.flowMsgs[prio] = request
         
@@ -1082,7 +1071,7 @@
             msg.command = ofp.OFPFC_DELETE_STRICT
             # This *must* be set for DELETE
             msg.out_port = ofp.OFPP_NONE
-            self.logger.debug("Remove flow with priority " + str(prio))
+            logging.debug("Remove flow with priority " + str(prio))
             self.controller.message_send(msg)
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
         else:
@@ -1093,10 +1082,8 @@
         if pkt == None:
             pkt = self.pkt
 
-        self.logger.info("Pkt match test: " + str(inp) + 
-                         " to " + str(egp))
-        self.logger.debug("Send packet: " + str(inp) + " to " 
-                            + str(egp))
+        logging.info("Pkt match test: " + str(inp) + " to " + str(egp))
+        logging.debug("Send packet: " + str(inp) + " to " + str(egp))
         self.dataplane.send(inp, str(pkt))
         receive_pkt_verify(self, egp, pkt, inp)
 
@@ -1321,8 +1308,8 @@
         of_ports = pa_port_map.keys()
         of_ports.sort()
         ing_port = of_ports[0]
-        pa_logger.info("Sending packet to " + str(ing_port))
-        pa_logger.debug("Data: " + str(pkt).encode('hex'))
+        logging.info("Sending packet to " + str(ing_port))
+        logging.debug("Data: " + str(pkt).encode('hex'))
         self.dataplane.send(ing_port, str(pkt))
 
 class PacketOnlyTagged(basic.DataPlaneOnly):
@@ -1335,8 +1322,8 @@
         of_ports = pa_port_map.keys()
         of_ports.sort()
         ing_port = of_ports[0]
-        pa_logger.info("Sending packet to " + str(ing_port))
-        pa_logger.debug("Data: " + str(pkt).encode('hex'))
+        logging.info("Sending packet to " + str(ing_port))
+        logging.debug("Data: " + str(pkt).encode('hex'))
         self.dataplane.send(ing_port, str(pkt))
 
 test_prio["PacketOnly"] = -1
@@ -1393,7 +1380,7 @@
         ing_port = of_ports[0]
         egr_ports = of_ports[1]
         
-        rv = delete_all_flows(self.controller, pa_logger)
+        rv = delete_all_flows(self.controller)
         self.assertEqual(rv, 0, "Failed to delete all flows")
 
         len_untagged = 100
@@ -1412,12 +1399,12 @@
                                   action_list=[vid_act])
         flow_msg_install(self, request)
 
-        pa_logger.debug("Send untagged packet: " + str(ing_port) + " to " + 
+        logging.debug("Send untagged packet: " + str(ing_port) + " to " + 
                         str(egr_ports))
         self.dataplane.send(ing_port, str(untagged_pkt))
         receive_pkt_verify(self, egr_ports, exp_pkt, ing_port)
 
-        pa_logger.debug("Send tagged packet: " + str(ing_port) + " to " + 
+        logging.debug("Send tagged packet: " + str(ing_port) + " to " + 
                         str(egr_ports))
         self.dataplane.send(ing_port, str(tagged_pkt))
         receive_pkt_verify(self, egr_ports, exp_pkt, ing_port)
@@ -1724,7 +1711,7 @@
         flow_count = test_param_get(self.config, 'ft_flow_count', default=20)
         iter_count = test_param_get(self.config, 'ft_iter_count', default=10)
 
-        pa_logger.info("Running flow toggle with %d flows, %d iterations" %
+        logging.info("Running flow toggle with %d flows, %d iterations" %
                        (flow_count, iter_count))
         acts = []
         acts.append(action.action_output())
@@ -1758,8 +1745,8 @@
                 flows[toggle].append(msg)
 
         # Show two sample flows
-        pa_logger.debug(flows[0][0].show())
-        pa_logger.debug(flows[1][0].show())
+        logging.debug(flows[0][0].show())
+        logging.debug(flows[1][0].show())
 
         # Install the first set of flows
         for f_idx in range(flow_count):
@@ -1767,7 +1754,7 @@
             self.assertTrue(rv != -1, "Error installing flow %d" % f_idx)
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
     
-        pa_logger.info("Installed %d flows" % flow_count)
+        logging.info("Installed %d flows" % flow_count)
     
         # Repeatedly modify all the flows back and forth
         updates = 0
@@ -1776,7 +1763,7 @@
         start = time.time()
         for iter_idx in range(iter_count):
             if not iter_idx % mod_val:
-                pa_logger.info("Flow Toggle: iter %d of %d. " %
+                logging.info("Flow Toggle: iter %d of %d. " %
                                (iter_idx, iter_count) + 
                                "%d updates in %d secs" %
                                (updates, time.time() - start))
@@ -1792,8 +1779,8 @@
 
         end = time.time()
         divisor = end - start or (end - start + 1)
-        pa_logger.info("Flow toggle: %d iterations" % iter_count)
-        pa_logger.info("   %d flow mods in %d secs, %d mods/sec" %
+        logging.info("Flow toggle: %d iterations" % iter_count)
+        logging.info("   %d flow mods in %d secs, %d mods/sec" %
                        (updates, end - start, updates/divisor))
             
 
@@ -1829,11 +1816,11 @@
     def runTest(self):
         count = test_param_get(self.config, 'iter_count', default=10)
         tests_done = 0
-        pa_logger.info("Running iteration test " + str(count) + " times")
+        logging.info("Running iteration test " + str(count) + " times")
         start = time.time()
         last = start
         for idx in range(count):
-            pa_logger.info("Iteration " + str(idx + 1))
+            logging.info("Iteration " + str(idx + 1))
             for cls in iter_classes:
                 test = cls()
                 test.inheritSetup(self)
@@ -1842,17 +1829,17 @@
                 # Report update about every minute, between tests
                 if time.time() - last > 60:
                     last = time.time()
-                    pa_logger.info(
+                    logging.info(
                         "IterCases: Iter %d of %d; Ran %d tests in %d " %
                         (idx, count, tests_done, last - start) + 
                         "seconds so far")
         stats = all_stats_get(self)
         last = time.time()
-        pa_logger.info("\nIterCases ran %d tests in %d seconds." %
+        logging.info("\nIterCases ran %d tests in %d seconds." %
                        (tests_done, last - start))
-        pa_logger.info("    flows: %d. packets: %d. bytes: %d" %
+        logging.info("    flows: %d. packets: %d. bytes: %d" %
                        (stats["flows"], stats["packets"], stats["bytes"]))
-        pa_logger.info("    active: %d. lookups: %d. matched %d." %
+        logging.info("    active: %d. lookups: %d. matched %d." %
                        (stats["active"], stats["lookups"], stats["matched"]))
 
 # Don't run by default
@@ -1903,14 +1890,14 @@
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
-        delete_all_flows(self.controller, pa_logger)
+        delete_all_flows(self.controller)
 
         pkt = simple_tcp_packet()
         ingress_port = of_ports[0]
         egress_port = of_ports[1]
 
         def testField(field, mask):
-            pa_logger.info("Testing field %s" % field)
+            logging.info("Testing field %s" % field)
 
             def addFlow(matching, priority, output_port):
                 match = packet_to_flow_match(self, pkt)
@@ -1932,7 +1919,7 @@
                 act = action.action_output()
                 act.port = output_port
                 self.assertTrue(request.actions.add(act), "Could not add action")
-                pa_logger.info("Inserting flow")
+                logging.info("Inserting flow")
                 self.controller.message_send(request)
 
             # This flow should match.
@@ -1942,7 +1929,7 @@
 
             self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
 
-            pa_logger.info("Sending packet to dp port " + str(ingress_port))
+            logging.info("Sending packet to dp port " + str(ingress_port))
             self.dataplane.send(ingress_port, str(pkt))
 
             exp_pkt_arg = None
@@ -1954,7 +1941,7 @@
             (rcv_port, rcv_pkt, pkt_time) = self.dataplane.poll(port_number=exp_port,
                                                                 exp_pkt=exp_pkt_arg)
             self.assertTrue(rcv_pkt is not None, "Did not receive packet")
-            pa_logger.debug("Packet len " + str(len(rcv_pkt)) + " in on " + str(rcv_port))
+            logging.debug("Packet len " + str(len(rcv_pkt)) + " in on " + str(rcv_port))
             self.assertEqual(rcv_port, egress_port, "Unexpected receive port")
             self.assertEqual(str(pkt), str(rcv_pkt), 'Response packet does not match send packet')
 
diff --git a/tests/port_stats.py b/tests/port_stats.py
index 96d3cc5..5cfb1bb 100644
--- a/tests/port_stats.py
+++ b/tests/port_stats.py
@@ -23,8 +23,6 @@
 #@var fs_port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 fs_port_map = None
-#@var fs_logger Local logger object
-fs_logger = None
 #@var fs_config Local copy of global configuration data
 fs_config = None
 
@@ -54,17 +52,14 @@
     basic.test_set_init(config)
 
     global fs_port_map
-    global fs_logger
     global fs_config
 
-    fs_logger = logging.getLogger("flow_stats")
-    fs_logger.info("Initializing test set")
     fs_port_map = config["port_map"]
     fs_config = config
 
 def sendPacket(obj, pkt, ingress_port, egress_port, test_timeout):
 
-    fs_logger.info("Sending packet to dp port " + str(ingress_port) +
+    logging.info("Sending packet to dp port " + str(ingress_port) +
                    ", expecting output on " + str(egress_port))
     obj.dataplane.send(ingress_port, str(pkt))
 
@@ -78,7 +73,7 @@
                                                        exp_pkt=exp_pkt_arg)
     obj.assertTrue(rcv_pkt is not None,
                    "Packet not received on port " + str(egress_port))
-    fs_logger.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
+    logging.debug("Packet len " + str(len(rcv_pkt)) + " in on " + 
                     str(rcv_port))
     obj.assertEqual(rcv_port, egress_port,
                     "Packet received on port " + str(rcv_port) +
@@ -90,17 +85,17 @@
     stat_req = message.port_stats_request()
     stat_req.port_no = port
 
-    fs_logger.info("Sending stats request")
+    logging.info("Sending stats request")
     response, pkt = obj.controller.transact(stat_req, timeout=2)
     obj.assertTrue(response is not None, 
                     "No response to stats request")
     obj.assertTrue(len(response.stats) == 1,
                     "Did not receive port stats reply")
     for item in response.stats:
-        fs_logger.info("Sent " + str(item.tx_packets) + " packets")
+        logging.info("Sent " + str(item.tx_packets) + " packets")
         packet_sent = item.tx_packets
         packet_recv = item.rx_packets
-    fs_logger.info("Port %d stats count: tx %d rx %d" % (port, packet_sent, packet_recv))
+    logging.info("Port %d stats count: tx %d rx %d" % (port, packet_sent, packet_recv))
     return packet_sent, packet_recv
 
 def verifyStats(obj, port, test_timeout, packet_sent, packet_recv):
@@ -111,7 +106,7 @@
     all_packets_sent = 0
     sent = recv = 0
     for i in range(0,test_timeout):
-        fs_logger.info("Sending stats request")
+        logging.info("Sending stats request")
         response, pkt = obj.controller.transact(stat_req,
                                                 timeout=test_timeout)
         obj.assertTrue(response is not None, 
@@ -121,10 +116,10 @@
         for item in response.stats:
             sent = item.tx_packets
             recv = item.rx_packets
-            fs_logger.info("Sent " + str(item.tx_packets) + " packets")
+            logging.info("Sent " + str(item.tx_packets) + " packets")
             if item.tx_packets == packet_sent:
                 all_packets_sent = 1
-            fs_logger.info("Received " + str(item.rx_packets) + " packets")
+            logging.info("Received " + str(item.rx_packets) + " packets")
             if item.rx_packets == packet_recv:
                 all_packets_received = 1
 
@@ -132,8 +127,8 @@
             break
         sleep(1)
 
-    fs_logger.info("Expected port %d stats count: tx %d rx %d" % (port, packet_sent, packet_recv))
-    fs_logger.info("Actual port %d stats count: tx %d rx %d" % (port, sent, recv))
+    logging.info("Expected port %d stats count: tx %d rx %d" % (port, packet_sent, packet_recv))
+    logging.info("Actual port %d stats count: tx %d rx %d" % (port, sent, recv))
     obj.assertTrue(all_packets_sent,
                    "Packet sent does not match number sent")
     obj.assertTrue(all_packets_received,
@@ -160,7 +155,7 @@
         of_ports.sort()
         self.assertTrue(len(of_ports) > 1, "Not enough ports for test")
 
-        rc = delete_all_flows(self.controller, fs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         # build packet
@@ -174,7 +169,7 @@
         # build flow
         ingress_port = of_ports[0];
         egress_port = of_ports[1];
-        fs_logger.info("Ingress " + str(ingress_port) + 
+        logging.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
         match.in_port = ingress_port
         flow_mod_msg = message.flow_mod()
@@ -187,7 +182,7 @@
         self.assertTrue(flow_mod_msg.actions.add(act), "Could not add action")
        
         # send flow
-        fs_logger.info("Inserting flow")
+        logging.info("Inserting flow")
         rv = self.controller.message_send(flow_mod_msg)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
@@ -198,7 +193,7 @@
 
         # send packet N times
         num_sends = random.randint(10,20)
-        fs_logger.info("Sending " + str(num_sends) + " test packets")
+        logging.info("Sending " + str(num_sends) + " test packets")
         for i in range(0,num_sends):
             sendPacket(self, pkt, ingress_port, egress_port,
                        test_timeout)
@@ -234,7 +229,7 @@
         act.port = egress_port
         self.assertTrue(flow_mod_msg.actions.add(act), "Could not add action")
 
-        fs_logger.info("Ingress " + str(ingress_port) + 
+        logging.info("Ingress " + str(ingress_port) + 
                        " to egress " + str(egress_port))
 
         return flow_mod_msg
@@ -252,7 +247,7 @@
         egress_port1 = of_ports[1];
         egress_port2 = of_ports[2];
 
-        rc = delete_all_flows(self.controller, fs_logger)
+        rc = delete_all_flows(self.controller)
         self.assertEqual(rc, 0, "Failed to delete all flows")
 
         pkt1 = simple_tcp_packet()
@@ -261,10 +256,10 @@
         pkt2 = simple_tcp_packet(dl_src='0:7:7:7:7:7')
         flow_mod_msg2 = self.buildFlowModMsg(pkt2, ingress_port, egress_port2)
        
-        fs_logger.info("Inserting flow1")
+        logging.info("Inserting flow1")
         rv = self.controller.message_send(flow_mod_msg1)
         self.assertTrue(rv != -1, "Error installing flow mod")
-        fs_logger.info("Inserting flow2")
+        logging.info("Inserting flow2")
         rv = self.controller.message_send(flow_mod_msg2)
         self.assertTrue(rv != -1, "Error installing flow mod")
         self.assertEqual(do_barrier(self.controller), 0, "Barrier failed")
@@ -275,9 +270,9 @@
         initTxOutPort2, initRxOutPort2 = getStats(self, egress_port2)
 
         num_pkt1s = random.randint(10,30)
-        fs_logger.info("Sending " + str(num_pkt1s) + " pkt1s")
+        logging.info("Sending " + str(num_pkt1s) + " pkt1s")
         num_pkt2s = random.randint(10,30)
-        fs_logger.info("Sending " + str(num_pkt2s) + " pkt2s")
+        logging.info("Sending " + str(num_pkt2s) + " pkt2s")
         for i in range(0,num_pkt1s):
             sendPacket(self, pkt1, ingress_port, egress_port1, test_timeout)
         for i in range(0,num_pkt2s):
diff --git a/tests/serial_failover.py b/tests/serial_failover.py
index 311dde1..8ba1766 100644
--- a/tests/serial_failover.py
+++ b/tests/serial_failover.py
@@ -22,8 +22,6 @@
 #@var serial_failover_port_map Local copy of the configuration map from OF port
 # numbers to OS interfaces
 serial_failover_port_map = None
-#@var serial_failover_logger Local logger object
-serial_failover_logger = None
 #@var serial_failover_config Local copy of global configuration data
 serial_failover_config = None
 
@@ -37,11 +35,8 @@
     """
 
     global serial_failover_port_map
-    global serial_failover_logger
     global serial_failover_config
 
-    serial_failover_logger = logging.getLogger("serial_failover")
-    serial_failover_logger.info("Initializing test set")
     serial_failover_port_map = config["port_map"]
     serial_failover_config = config
 
@@ -65,7 +60,7 @@
     test_iterations = 0
 
     def sig_handler(self, v1, v2):
-        serial_failover_logger.critical("Received interrupt signal; exiting")
+        logging.critical("Received interrupt signal; exiting")
         print "Received interrupt signal; exiting"
         self.clean_shutdown = False
         self.tearDown()
@@ -89,7 +84,7 @@
         reply, pkt = self.controller.transact(request, timeout=20)
         self.assertTrue(reply is not None,
                         "Did not complete features_request for handshake")
-        serial_failover_logger.info("Connected " + 
+        logging.info("Connected " + 
                                     str(self.controller.switch_addr))
 
         # send echo request and wait for reply
@@ -103,10 +98,10 @@
 
     def connectionKill(self, kill_method):
         if kill_method == 'controller_shutdown':
-            serial_failover_logger.info("Shutting down controller")
+            logging.info("Shutting down controller")
             self.controller.shutdown()
         elif kill_method == 'no_echo':
-            serial_failover_logger.info("Disabling controller keep alive")
+            logging.info("Disabling controller keep alive")
             self.controller.keep_alive = False
 
             # wait for controller to die
@@ -121,7 +116,7 @@
         # controller_list is list of ip/port tuples
         partial_list = test_param_get(serial_failover_config,
                                       'controller_list')
-        serial_failover_logger.debug("ctrl list: " + str(partial_list))
+        logging.debug("ctrl list: " + str(partial_list))
         self.controller_list = [(serial_failover_config["controller_host"],
                                  serial_failover_config["controller_port"])]
         if partial_list is not None:
@@ -143,15 +138,14 @@
         return self.controller_list[self.controller_idx]
 
     def setUp(self):
-        self.logger = serial_failover_logger
         self.config = serial_failover_config
         #@todo Test cases shouldn't monkey with signals; move SIGINT handler
         # to top-level oft
         try:
            signal.signal(signal.SIGINT, self.sig_handler)
         except ValueError, e:
-           serial_failover_logger.info("Could not set SIGINT handler: %s" % e)
-        serial_failover_logger.info("** START TEST CASE " + str(self))
+           logging.info("Could not set SIGINT handler: %s" % e)
+        logging.info("** START TEST CASE " + str(self))
 
         self.test_timeout = test_param_get(serial_failover_config,
                                            'failover_timeout') or 60
@@ -178,27 +172,26 @@
         the state after the sub_test is run must be taken into account
         by subsequent operations.
         """
-        self.logger = parent.logger
         self.config = parent.config
-        serial_failover_logger.info("** Setup " + str(self) + 
+        logging.info("** Setup " + str(self) + 
                                     " inheriting from " + str(parent))
         self.controller = parent.controller
         
     def tearDown(self):
-        serial_failover_logger.info("** END TEST CASE " + str(self))
+        logging.info("** END TEST CASE " + str(self))
         self.controller.shutdown()
         if self.clean_shutdown:
             self.controller.join()
 
     def doFailover(self, killmethod):
-        serial_failover_logger.info("Starting serial failover test")
+        logging.info("Starting serial failover test")
         self.assertTrue(self.controller.switch_socket is not None,
                         str(self) + 'No connection to switch')
         # kill controller connection
         self.connectionKill(killmethod)
         # establish new controller connection
         controller = self.getNextController()
-        serial_failover_logger.debug("** Next controller (%u/%u)%s:%u" % 
+        logging.debug("** Next controller (%u/%u)%s:%u" % 
                                      (self.controller_idx,
                                       len(self.controller_list),
                                       controller[0],
@@ -211,7 +204,7 @@
 
     def assertTrue(self, cond, msg):
         if not cond:
-            serial_failover_logger.error("** FAILED ASSERTION: " + msg)
+            logging.error("** FAILED ASSERTION: " + msg)
         unittest.TestCase.assertTrue(self, cond, msg)
 
 test_prio["SerialFailover"] = -1
