Commit 3f51363f authored by Jim Fulton's avatar Jim Fulton

Merged the chrisw-error_logging branch:

Bug fixed:
- Internal ZEO errors were logged at the INFO level, rather
  than at the error level.
parent 90630c4f
......@@ -13,6 +13,9 @@ Bugs Fixed
- zope.testing was an unnecessary non-testing dependency.
- Internal ZEO errors were logged at the INFO level, rather
than at the error level.
3.9.3 (2009-10-23)
==================
......
......@@ -438,15 +438,13 @@ class HeartbeatTests(ZEO.tests.ConnectionTests.CommonSetupTearDown):
> client_timeout_count)
class CatastrophicClientLoopFailure(
ZEO.tests.ConnectionTests.CommonSetupTearDown):
"""Test what happens when the client loop falls over
"""
class ZRPCConnectionTests(ZEO.tests.ConnectionTests.CommonSetupTearDown):
def getConfig(self, path, create, read_only):
return """<mappingstorage 1/>"""
def checkCatastrophicClientLoopFailure(self):
# Test what happens when the client loop falls over
self._storage = self.openClientStorage()
class Evil:
......@@ -474,13 +472,30 @@ class CatastrophicClientLoopFailure(
self.assertEqual(log[1][0], "Couldn't close a dispatcher.")
self.assert_('exc_info' in log[1][1])
class ConnectionInvalidationOnReconnect(
ZEO.tests.ConnectionTests.CommonSetupTearDown):
"""Test what happens when the client loop falls over
"""
def checkExceptionLogsAtError(self):
# Test the exceptions are logged at error
self._storage = self.openClientStorage()
conn = self._storage._connection
# capture logging
log = []
conn.logger.log = (
lambda l, m, *a, **kw: log.append((l,m % a, kw))
)
def getConfig(self, path, create, read_only):
return """<mappingstorage 1/>"""
# This is a deliberately bogus call to get an exception
# logged
self._storage._connection.handle_request('foo',0,'history',(1,2,3,4))
# test logging
level,message,kw = log[1]
self.assertEqual(level,logging.ERROR)
self.failUnless(message.endswith(
') history() raised exception: history() takes at'
' most 3 arguments (5 given)'
))
self.assertEqual(kw,{'exc_info':True})
# cleanup
del conn.logger.log
def checkConnectionInvalidationOnReconnect(self):
......@@ -1216,7 +1231,7 @@ slow_test_classes = [
quick_test_classes = [
FileStorageRecoveryTests, ConfigurationTests, HeartbeatTests,
CatastrophicClientLoopFailure, ConnectionInvalidationOnReconnect,
ZRPCConnectionTests,
]
class ServerManagingClientStorage(ClientStorage):
......
......@@ -586,7 +586,7 @@ class Connection(smac.SizedMessageAsyncConnection, object):
except Exception, msg:
if not isinstance(msg, self.unlogged_exception_types):
self.log("%s() raised exception: %s" % (name, msg),
logging.INFO, exc_info=True)
logging.ERROR, exc_info=True)
error = sys.exc_info()[:2]
return self.return_error(msgid, flags, *error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment