[Zope-Checkins] CVS: Zope/lib/python/Zope - __init__.py:1.25
Chris McDonough
chrism@zope.com
Fri, 16 Nov 2001 14:48:21 -0500
Update of /cvs-repository/Zope/lib/python/Zope
In directory cvs.zope.org:/tmp/cvs-serv20299
Modified Files:
__init__.py
Log Message:
Caused conflict errors to be counted at log time; additionally bumped severity back up to INFO for conflict logging, but caused conflict tracebacks to be logged at BLATHER.
=== Zope/lib/python/Zope/__init__.py 1.24 => 1.25 ===
sys.path.insert(0, os.path.join(SOFTWARE_HOME, 'ZopeZODB3'))
#######################################################################
-
import ZODB, ZODB.ZApplication, imp
import Globals, OFS.Application, sys
import AccessControl.SecurityManagement, AccessControl.User
@@ -159,8 +158,9 @@
import ZODB.POSException, ZPublisher, string, ZPublisher
import ExtensionClass
-from zLOG import LOG, INFO, WARNING, BLATHER
-
+from zLOG import LOG, WARNING, INFO, BLATHER, log_time
+conflict_errors = 0
+startup_time = log_time()
def debug(*args, **kw):
return apply(ZPublisher.test,('Zope',)+args, kw)
@@ -186,9 +186,13 @@
# do this by releasing the hold on it. There should be
# some sane protocol for this, but for now we'll use
# brute force:
- LOG('Z2 CONFLICT', BLATHER,
- 'Competing writes at, %s' % REQUEST.get('PATH_INFO', ''),
- error=sys.exc_info())
+ global conflict_errors
+ conflict_errors = conflict_errors + 1
+ method_name = REQUEST.get('PATH_INFO', '')
+ err = ('ZODB conflict error at %s (%s conflicts since startup '
+ 'at %s)')
+ LOG(err % (method_name, conflict_errors, startup_time), INFO, '')
+ LOG('Conflict traceback', BLATHER, '', error=sys.exc_info())
raise ZPublisher.Retry(t, v, traceback)
if t is ZPublisher.Retry: v.reraise()