Commit b39a309d authored by Florent Guillaume's avatar Florent Guillaume

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 498a8e48
...@@ -44,6 +44,10 @@ Zope Changes ...@@ -44,6 +44,10 @@ Zope Changes
- The SiteErrorLog now copies exceptions to the event log by default. - The SiteErrorLog now copies exceptions to the event log by default.
- 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'.
Zope 2.9.0 beta 1 (2005/12/06) Zope 2.9.0 beta 1 (2005/12/06)
Features added Features added
......
...@@ -136,7 +136,7 @@ class RequestContainer(ExtensionClass.Base): ...@@ -136,7 +136,7 @@ class RequestContainer(ExtensionClass.Base):
conflict_errors = 0 conflict_errors = 0
unresolved_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): def zpublisher_exception_hook(published, REQUEST, t, v, traceback):
global unresolved_conflict_errors global unresolved_conflict_errors
...@@ -149,19 +149,18 @@ def zpublisher_exception_hook(published, REQUEST, t, v, traceback): ...@@ -149,19 +149,18 @@ def zpublisher_exception_hook(published, REQUEST, t, v, traceback):
if t is SystemExit: if t is SystemExit:
raise raise
if issubclass(t, ConflictError): if issubclass(t, ConflictError):
conflict_errors = conflict_errors + 1 conflict_errors += 1
# This logs _all_ conflict errors level = getConfiguration().conflict_error_log_level
conflict_logger.info( if level:
'%s at %s (%i conflicts, of which %i' conflict_logger.log(level,
' were unresolved, since startup at %s)', "%s at %s: %s (%d conflicts (%d unresolved) "
v, "since startup at %s)",
REQUEST.get('PATH_INFO', '<unknown>'), v.__class__.__name__,
conflict_errors, REQUEST.get('PATH_INFO', '<unknown>'),
unresolved_conflict_errors, v,
startup_time conflict_errors,
) unresolved_conflict_errors,
# This debug logging really doesn't help a lot... startup_time)
conflict_logger.debug('Conflict traceback',exc_info=True)
raise ZPublisher.Retry(t, v, traceback) raise ZPublisher.Retry(t, v, traceback)
if t is ZPublisher.Retry: if t is ZPublisher.Retry:
try: try:
......
...@@ -760,6 +760,20 @@ ...@@ -760,6 +760,20 @@
</description> </description>
</section> </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 <!-- max-listen-sockets and large-file-threshold should really go
into the ZServer package, but I can't quite figure out how to into the ZServer package, but I can't quite figure out how to
put it there --> put it there -->
......
...@@ -759,6 +759,24 @@ instancehome $INSTANCE ...@@ -759,6 +759,24 @@ instancehome $INSTANCE
# </logfile> # </logfile>
# </logger> # </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 # Directive: warnfilter
# #
# Description: # 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