[Zope3-checkins] CVS: Zope3/lib/python/ZEO/tests - ConnectionTests.py:1.4

Tim Peters tim.one@comcast.net
Thu, 19 Dec 2002 16:21:57 -0500


Update of /cvs-repository/Zope3/lib/python/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv1807/lib/python/ZEO/tests

Modified Files:
	ConnectionTests.py 
Log Message:
Use a class logger for ConnectionTests.py.


=== Zope3/lib/python/ZEO/tests/ConnectionTests.py 1.3 => 1.4 ===
--- Zope3/lib/python/ZEO/tests/ConnectionTests.py:1.3	Mon Dec 16 18:10:57 2002
+++ Zope3/lib/python/ZEO/tests/ConnectionTests.py	Thu Dec 19 16:21:56 2002
@@ -21,8 +21,7 @@
 import asyncore
 import tempfile
 import threading
-
-import zLOG
+import logging
 
 from ZEO.ClientStorage import ClientStorage
 from ZEO.Exceptions import Disconnected
@@ -61,7 +60,8 @@
         for i in 1, 2, ...
         """
         self.__super_setUp()
-        zLOG.LOG("testZEO", zLOG.INFO, "setUp() %s" % self.id())
+        self.logger = logging.getLogger("testZEO")
+        self.logger.warn("setUp() %s", self.id())
         self.file = tempfile.mktemp()
         self.addr = []
         self._pids = []
@@ -71,7 +71,7 @@
 
     def tearDown(self):
         """Try to cause the tests to halt"""
-        zLOG.LOG("testZEO", zLOG.INFO, "tearDown() %s" % self.id())
+        self.logger.warn("tearDown() %s", self.id())
         if getattr(self, '_storage', None) is not None:
             self._storage.close()
             if hasattr(self._storage, 'cleanup'):
@@ -116,9 +116,8 @@
     def startServer(self, create=True, index=0,
                     read_only=False, ro_svr=False, keep=False):
         addr = self.addr[index]
-        zLOG.LOG("testZEO", zLOG.INFO,
-                 "startServer(create=%d, index=%d, read_only=%d) @ %s" %
-                 (create, index, read_only, addr))
+        self.logger.warn("startServer(create=%d, index=%d, read_only=%d) @ %s",
+                         create, index, read_only, addr)
         path = "%s.%d" % (self.file, index)
         conf = self.getConfig(path, create, read_only)
         zeoport, adminaddr, pid = forker.start_zeo_server(
@@ -127,8 +126,8 @@
         self._servers.append(adminaddr)
 
     def shutdownServer(self, index=0):
-        zLOG.LOG("testZEO", zLOG.INFO, "shutdownServer(index=%d) @ %s" %
-                 (index, self._servers[index]))
+        self.logger.warn("shutdownServer(index=%d) @ %s", index,
+                         self._servers[index])
         adminaddr = self._servers[index]
         if adminaddr is not None:
             forker.shutdown_zeo_server(adminaddr)
@@ -322,11 +321,9 @@
         oid = self._storage.new_oid()
         obj = MinPO(12)
         self._dostore(oid, data=obj)
-        zLOG.LOG("checkReconnection", zLOG.INFO,
-                 "About to shutdown server")
+        self.logger.warn("checkReconnection: About to shutdown server")
         self.shutdownServer()
-        zLOG.LOG("checkReconnection", zLOG.INFO,
-                 "About to restart server")
+        self.logger.warn("checkReconnection: About to restart server")
         self.startServer(create=False)
         oid = self._storage.new_oid()
         obj = MinPO(12)
@@ -336,9 +333,9 @@
                 break
             except (Disconnected, select.error,
                     threading.ThreadError, socket.error):
-                zLOG.LOG("checkReconnection", zLOG.INFO,
-                         "Error after server restart; retrying.",
-                         error=sys.exc_info())
+                self.logger.warn("checkReconnection: "
+                                 "Error after server restart; retrying.",
+                                 exc_info=True)
                 get_transaction().abort()
                 time.sleep(0.1) # XXX how long to sleep
             # XXX This is a bloody pain.  We're placing a heavy burden
@@ -346,7 +343,7 @@
             # write robust code.  Need to think about implementing
             # John Heintz's suggestion to make sure all exceptions
             # inherit from POSException.
-        zLOG.LOG("checkReconnection", zLOG.INFO, "finished")
+        self.logger.warn("checkReconnection: finished")
 
     def checkBadMessage1(self):
         # not even close to a real message