[Zope-Checkins] CVS: Zope3/src/ZEO/tests - ConnectionTests.py:1.56
forker.py:1.43 testZEO.py:1.80 zeoserver.py:1.26
Gintautas Miliauskas
gintas at pov.lt
Sun Apr 25 07:34:24 EDT 2004
Update of /cvs-repository/Zope3/src/ZEO/tests
In directory cvs.zope.org:/tmp/cvs-serv23562/tests
Modified Files:
ConnectionTests.py forker.py testZEO.py zeoserver.py
Log Message:
This should be the last nail in zLOG's coffin. grep reveals no more references
to zLOG other than a few comments.
This definitely broke the log analyzers pretty bad.
=== Zope3/src/ZEO/tests/ConnectionTests.py 1.55 => 1.56 ===
--- Zope3/src/ZEO/tests/ConnectionTests.py:1.55 Mon Apr 19 17:19:04 2004
+++ Zope3/src/ZEO/tests/ConnectionTests.py Sun Apr 25 07:34:18 2004
@@ -19,8 +19,7 @@
import asyncore
import tempfile
import threading
-
-import zLOG
+import logging
import ZEO.ServerStub
from ZEO.ClientStorage import ClientStorage
@@ -38,6 +37,8 @@
import transaction
from transaction import Transaction
+logger = logging.getLogger('ZEO.tests.ConnectionTests')
+
ZERO = '\0'*8
class TestServerStub(ZEO.ServerStub.StorageServer):
@@ -91,7 +92,7 @@
for i in 1, 2, ...
"""
self.__super_setUp()
- zLOG.LOG("testZEO", zLOG.INFO, "setUp() %s" % self.id())
+ logging.info("setUp() %s", self.id())
self.file = tempfile.mktemp()
self.addr = []
self._pids = []
@@ -103,13 +104,13 @@
def tearDown(self):
"""Try to cause the tests to halt"""
- zLOG.LOG("testZEO", zLOG.INFO, "tearDown() %s" % self.id())
+ logging.info("tearDown() %s" % self.id())
for p in self.conf_paths:
os.remove(p)
if getattr(self, '_storage', None) is not None:
self._storage.close()
if hasattr(self._storage, 'cleanup'):
- zLOG.LOG("testZEO", zLOG.DEBUG, "cleanup storage %s" %
+ logging.debug("cleanup storage %s" %
self._storage.__name__)
self._storage.cleanup()
for adminaddr in self._servers:
@@ -191,9 +192,8 @@
def startServer(self, create=1, index=0, read_only=0, ro_svr=0, keep=None):
addr = self.addr[index]
- zLOG.LOG("testZEO", zLOG.INFO,
- "startServer(create=%d, index=%d, read_only=%d) @ %s" %
- (create, index, read_only, addr))
+ logging.info("startServer(create=%d, index=%d, read_only=%d) @ %s" %
+ (create, index, read_only, addr))
path = "%s.%d" % (self.file, index)
sconf = self.getConfig(path, create, read_only)
zconf = self.getServerConfig(addr, ro_svr)
@@ -206,8 +206,8 @@
self._servers.append(adminaddr)
def shutdownServer(self, index=0):
- zLOG.LOG("testZEO", zLOG.INFO, "shutdownServer(index=%d) @ %s" %
- (index, self._servers[index]))
+ logging.info("shutdownServer(index=%d) @ %s" %
+ (index, self._servers[index]))
adminaddr = self._servers[index]
if adminaddr is not None:
forker.shutdown_zeo_server(adminaddr)
@@ -450,11 +450,9 @@
oid = self._storage.new_oid()
obj = MinPO(12)
self._dostore(oid, data=obj)
- zLOG.LOG("checkReconnection", zLOG.INFO,
- "About to shutdown server")
+ logging.info("checkReconnection(): About to shutdown server")
self.shutdownServer()
- zLOG.LOG("checkReconnection", zLOG.INFO,
- "About to restart server")
+ logging.info("checkReconnection(): About to restart server")
self.startServer(create=0)
oid = self._storage.new_oid()
obj = MinPO(12)
@@ -464,13 +462,12 @@
break
except ClientDisconnected:
# Maybe the exception mess is better now
- zLOG.LOG("checkReconnection", zLOG.INFO,
- "Error after server restart; retrying.",
- error=sys.exc_info())
+ logging.info("checkReconnection(): Error after"
+ " server restart; retrying.", exc_info=True)
transaction.abort()
# Give the other thread a chance to run.
time.sleep(0.1)
- zLOG.LOG("checkReconnection", zLOG.INFO, "finished")
+ logging.info("checkReconnection(): finished")
self._storage.close()
def checkBadMessage1(self):
@@ -832,7 +829,7 @@
self.pollDown()
self._storage.verify_result = None
perstorage.verify_result = None
- zLOG.LOG("testZEO", zLOG.INFO, '2ALLBEEF')
+ logging.info('2ALLBEEF')
self.startServer(create=0, keep=0)
self.pollUp()
self.pollUp(storage=perstorage)
=== Zope3/src/ZEO/tests/forker.py 1.42 => 1.43 ===
--- Zope3/src/ZEO/tests/forker.py:1.42 Tue Apr 13 10:24:50 2004
+++ Zope3/src/ZEO/tests/forker.py Sun Apr 25 07:34:18 2004
@@ -21,8 +21,9 @@
import logging
import StringIO
import tempfile
+import logging
-import zLOG
+logger = logging.getLogger('ZEO.tests.forker')
class ZEOConfig:
"""Class to generate ZEO configuration file. """
@@ -143,19 +144,19 @@
for i in range(120):
time.sleep(0.25)
try:
- zLOG.LOG('forker', zLOG.DEBUG, 'connect %s' % i)
+ logger.debug('connect %s', i)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(adminaddr)
ack = s.recv(1024)
s.close()
- zLOG.LOG('forker', zLOG.DEBUG, 'acked: %s' % ack)
+ logging.debug('acked: %s' % ack)
break
except socket.error, e:
if e[0] not in (errno.ECONNREFUSED, errno.ECONNRESET):
raise
s.close()
else:
- zLOG.LOG('forker', zLOG.DEBUG, 'boo hoo')
+ logging.debug('boo hoo')
raise
return ('localhost', port), adminaddr, pid, tmpfile
@@ -187,5 +188,5 @@
if e[0] == errno.ECONNRESET:
raise
ack = 'no ack received'
- zLOG.LOG('shutdownServer', zLOG.DEBUG, 'acked: %s' % ack)
+ logger.debug('shutdown_zeo_server(): acked: %s' % ack)
s.close()
=== Zope3/src/ZEO/tests/testZEO.py 1.79 => 1.80 ===
--- Zope3/src/ZEO/tests/testZEO.py:1.79 Thu Feb 26 19:31:52 2004
+++ Zope3/src/ZEO/tests/testZEO.py Sun Apr 25 07:34:18 2004
@@ -20,16 +20,13 @@
import asyncore
import tempfile
import unittest
-
-# Zope/ZODB3 imports
-import zLOG
+import logging
# ZODB test support
import ZODB
from ZODB.tests.MinPO import MinPO
from ZODB.tests.StorageTestBase import zodb_unpickle
-
# ZODB test mixin classes
from ZODB.tests import StorageTestBase, BasicStorage, VersionStorage, \
TransactionalUndoStorage, TransactionalUndoVersionStorage, \
@@ -39,6 +36,8 @@
from ZEO.ClientStorage import ClientStorage
from ZEO.tests import forker, Cache, CommitLockTests, ThreadTests
+logger = logging.getLogger('ZEO.tests.testZEO')
+
class DummyDB:
def invalidate(self, *args):
pass
@@ -113,7 +112,7 @@
"""Combine tests from various origins in one class."""
def setUp(self):
- zLOG.LOG("testZEO", zLOG.INFO, "setUp() %s" % self.id())
+ logger.info("setUp() %s", self.id()) # XXX is this really needed?
port = get_port()
zconf = forker.ZEOConfig(('', port))
zport, adminaddr, pid, path = forker.start_zeo_server(self.getConfig(),
=== Zope3/src/ZEO/tests/zeoserver.py 1.25 => 1.26 ===
--- Zope3/src/ZEO/tests/zeoserver.py:1.25 Thu Feb 26 19:31:52 2004
+++ Zope3/src/ZEO/tests/zeoserver.py Sun Apr 25 07:34:18 2004
@@ -22,9 +22,10 @@
import signal
import asyncore
import threading
+import logging
+
import ThreadedAsync.LoopCallback
-import zLOG
from ZEO.StorageServer import StorageServer
from ZEO.runzeo import ZEOOptions
@@ -38,9 +39,11 @@
except AttributeError:
pass
+logger = logging.getLogger('ZEO.tests.zeoserver')
def log(label, msg, *args):
- zLOG.LOG(label, zLOG.DEBUG, msg % args)
+ message = "(%s) %s" % (label, msg)
+ logger.debug(message, args)
class ZEOTestServer(asyncore.dispatcher):
@@ -67,8 +70,7 @@
self._keep = keep
# Count down to zero, the number of connects
self._count = 1
- # For zLOG
- self._label ='zeoserver:%d @ %s' % (os.getpid(), addr)
+ self._label ='%d @ %s' % (os.getpid(), addr)
self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
# Some ZEO tests attempt a quick start of the server using the same
# port so we have to set the reuse flag.
@@ -126,7 +128,7 @@
# as long as 300 seconds. Set this timeout to 330 to minimize
# chance that the server gives up before the clients.
time.sleep(330)
- log("zeoserver", "suicide thread invoking shutdown")
+ log(str(os.getpid()), "suicide thread invoking shutdown")
# If the server hasn't shut down yet, the client may not be
# able to connect to it. If so, try to kill the process to
@@ -146,8 +148,8 @@
def main():
global pid
pid = os.getpid()
- label = 'zeoserver:%d' % pid
- log(label, 'starting')
+ label = str(pid)
+ log(label, "starting")
# We don't do much sanity checking of the arguments, since if we get it
# wrong, it's a bug in the test suite.
More information about the Zope-Checkins
mailing list