Commit 6d23d8ff authored by Florent Guillaume's avatar Florent Guillaume

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'.
parent 8fee2c23
......@@ -26,6 +26,10 @@ Zope Changes
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
......
......@@ -135,7 +135,7 @@ class RequestContainer(ExtensionClass.Base):
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 @@ def zpublisher_exception_hook(published, REQUEST, t, v, traceback):
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,
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
)
# This debug logging really doesn't help a lot...
conflict_logger.debug('Conflict traceback',exc_info=True)
startup_time)
raise ZPublisher.Retry(t, v, traceback)
if t is ZPublisher.Retry:
try:
......
......@@ -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 -->
......
......@@ -759,6 +759,24 @@ instancehome $INSTANCE
# </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:
......
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