[Zope-Checkins] SVN: Zope/trunk/ Merged r40864 from 2.9 branch:

Florent Guillaume fg at nuxeo.com
Sun Dec 18 14:19:29 EST 2005


Log message for revision 40865:
  Merged r40864 from 2.9 branch:
  Added a 'conflict-error-log-level' directive to zope.conf, to set the
  level at which conflict errors (which are normally retried
  automatically) are logged. The default is 'info'.
  
  This doesn't interfere with the error_log site object which copies
  non-retried conflict errors the the error log at level 'error'.
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/Zope2/App/startup.py
  U   Zope/trunk/lib/python/Zope2/Startup/zopeschema.xml
  U   Zope/trunk/skel/etc/zope.conf.in

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2005-12-18 19:01:42 UTC (rev 40864)
+++ Zope/trunk/doc/CHANGES.txt	2005-12-18 19:19:29 UTC (rev 40865)
@@ -26,6 +26,10 @@
 
     Features added
 
+      - Added a 'conflict-error-log-level' directive to zope.conf, to set
+        the level at which conflict errors (which are normally retried
+        automatically) are logged. The default is 'info'.
+
       - The SiteErrorLog now copies exceptions to the event log by default.
 
       - deprecated OFS.content_types (to be removed in Zope 2.11) and

Modified: Zope/trunk/lib/python/Zope2/App/startup.py
===================================================================
--- Zope/trunk/lib/python/Zope2/App/startup.py	2005-12-18 19:01:42 UTC (rev 40864)
+++ Zope/trunk/lib/python/Zope2/App/startup.py	2005-12-18 19:19:29 UTC (rev 40865)
@@ -135,7 +135,7 @@
 conflict_errors = 0
 unresolved_conflict_errors = 0
 
-conflict_logger = logging.getLogger('ZODB.Conflict')
+conflict_logger = logging.getLogger('ZPublisher.Conflict')
 
 def zpublisher_exception_hook(published, REQUEST, t, v, traceback):
     global unresolved_conflict_errors
@@ -148,19 +148,18 @@
             if t is SystemExit:
                 raise
             if issubclass(t, ConflictError):
-                conflict_errors = conflict_errors + 1
-                # This logs _all_ conflict errors
-                conflict_logger.info(
-                    '%s at %s (%i conflicts, of which %i'
-                    ' were unresolved, since startup at %s)',
-                    v,
-                    REQUEST.get('PATH_INFO', '<unknown>'),
-                    conflict_errors,
-                    unresolved_conflict_errors,
-                    startup_time
-                    )
-                # This debug logging really doesn't help a lot...
-                conflict_logger.debug('Conflict traceback',exc_info=True)
+                conflict_errors += 1
+                level = getConfiguration().conflict_error_log_level
+                if level:
+                    conflict_logger.log(level,
+                        "%s at %s: %s (%d conflicts (%d unresolved) "
+                        "since startup at %s)",
+                        v.__class__.__name__,
+                        REQUEST.get('PATH_INFO', '<unknown>'),
+                        v,
+                        conflict_errors,
+                        unresolved_conflict_errors,
+                        startup_time)
                 raise ZPublisher.Retry(t, v, traceback)
             if t is ZPublisher.Retry:
                 try:

Modified: Zope/trunk/lib/python/Zope2/Startup/zopeschema.xml
===================================================================
--- Zope/trunk/lib/python/Zope2/Startup/zopeschema.xml	2005-12-18 19:01:42 UTC (rev 40864)
+++ Zope/trunk/lib/python/Zope2/Startup/zopeschema.xml	2005-12-18 19:19:29 UTC (rev 40865)
@@ -760,6 +760,20 @@
     </description>
   </section>
 
+  <key name="conflict-error-log-level"
+       datatype="ZConfig.components.logger.datatypes.logging_level"
+       default="info">
+     <description>
+       Specifies at which level conflict errors are logged. Conflict
+       errors, when occuring in small numbers, are a normal part of the
+       Zope optimistic transaction conflict resolution algorithms. They
+       are retried automatically a few times, and are therefore usually
+       not visible by the user. You can specify 'notset' if you don't
+       want them logged, or use any other logger level.
+     </description>
+     <metadefault>info</metadefault>
+  </key>
+
   <!-- max-listen-sockets and large-file-threshold should really go
        into the ZServer package, but I can't quite figure out how to
        put it there -->

Modified: Zope/trunk/skel/etc/zope.conf.in
===================================================================
--- Zope/trunk/skel/etc/zope.conf.in	2005-12-18 19:01:42 UTC (rev 40864)
+++ Zope/trunk/skel/etc/zope.conf.in	2005-12-18 19:19:29 UTC (rev 40865)
@@ -759,6 +759,24 @@
 #   </logfile>
 # </logger>
 
+
+# Directive: conflict-error-log-level
+#
+# Description:
+#     Specifies at which level conflict errors are logged. Conflict
+#     errors, when occuring in small numbers, are a normal part of the
+#     Zope optimistic transaction conflict resolution algorithms. They
+#     are retried automatically a few times, and are therefore usually
+#     not visible by the user. You can specify 'notset' if you don't
+#     want them logged, or use any other logger level (see above).
+#
+# Default: info
+#
+# Example:
+#
+#    conflict-error-log-level blather
+
+
 # Directive: warnfilter
 #
 # Description:



More information about the Zope-Checkins mailing list