Commit 9b95134c authored by Shane Hathaway's avatar Shane Hathaway

- Made the list of ignored exceptions configurable through the web.

- Show the most recent log entry first.
parent 9bdf999d
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Site error log module. """Site error log module.
$Id: SiteErrorLog.py,v 1.10 2002/08/14 22:25:11 mj Exp $ $Id: SiteErrorLog.py,v 1.11 2002/08/21 14:23:24 shane Exp $
""" """
import os import os
...@@ -203,8 +203,11 @@ class SiteErrorLog (SimpleItem): ...@@ -203,8 +203,11 @@ class SiteErrorLog (SimpleItem):
security.declareProtected(use_error_logging, 'getProperties') security.declareProtected(use_error_logging, 'getProperties')
def getProperties(self): def getProperties(self):
return {'keep_entries': self.keep_entries, return {
'copy_to_zlog': self.copy_to_zlog} 'keep_entries': self.keep_entries,
'copy_to_zlog': self.copy_to_zlog,
'ignored_exceptions': self._ignored_exceptions,
}
security.declareProtected(log_to_event_log, 'checkEventLogPermission') security.declareProtected(log_to_event_log, 'checkEventLogPermission')
def checkEventLogPermission(self): def checkEventLogPermission(self):
...@@ -214,7 +217,8 @@ class SiteErrorLog (SimpleItem): ...@@ -214,7 +217,8 @@ class SiteErrorLog (SimpleItem):
return 1 return 1
security.declareProtected(use_error_logging, 'setProperties') security.declareProtected(use_error_logging, 'setProperties')
def setProperties(self, keep_entries, copy_to_zlog=0, RESPONSE=None): def setProperties(self, keep_entries, copy_to_zlog=0,
ignored_exceptions=(), RESPONSE=None):
"""Sets the properties of this site error log. """Sets the properties of this site error log.
""" """
copy_to_zlog = not not copy_to_zlog copy_to_zlog = not not copy_to_zlog
...@@ -223,6 +227,8 @@ class SiteErrorLog (SimpleItem): ...@@ -223,6 +227,8 @@ class SiteErrorLog (SimpleItem):
self.checkEventLogPermission() self.checkEventLogPermission()
self.keep_entries = int(keep_entries) self.keep_entries = int(keep_entries)
self.copy_to_zlog = copy_to_zlog self.copy_to_zlog = copy_to_zlog
self._ignored_exceptions = tuple(
filter(None, map(str, ignored_exceptions)))
if RESPONSE is not None: if RESPONSE is not None:
RESPONSE.redirect( RESPONSE.redirect(
'%s/manage_main?manage_tabs_message=Changed+properties.' % '%s/manage_main?manage_tabs_message=Changed+properties.' %
...@@ -230,12 +236,14 @@ class SiteErrorLog (SimpleItem): ...@@ -230,12 +236,14 @@ class SiteErrorLog (SimpleItem):
security.declareProtected(use_error_logging, 'getLogEntries') security.declareProtected(use_error_logging, 'getLogEntries')
def getLogEntries(self): def getLogEntries(self):
"""Returns the entries in the log. """Returns the entries in the log, most recent first.
Makes a copy to prevent changes. Makes a copy to prevent changes.
""" """
# List incomprehension ;-) # List incomprehension ;-)
return [entry.copy() for entry in self._getLog()] res = [entry.copy() for entry in self._getLog()]
res.reverse()
return res
security.declareProtected(use_error_logging, 'getLogEntryById') security.declareProtected(use_error_logging, 'getLogEntryById')
def getLogEntryById(self, id): def getLogEntryById(self, id):
......
...@@ -33,6 +33,17 @@ file(s). ...@@ -33,6 +33,17 @@ file(s).
disabled not:container/checkEventLogPermission|nothing" /> disabled not:container/checkEventLogPermission|nothing" />
</td> </td>
</tr> </tr>
<tr>
<td align="left" valign="top">
<div class="form-label">
Ignored exception types
</div>
</td>
<td align="left" valign="top">
<textarea name="ignored_exceptions:lines" cols="40" rows="3"
tal:content="python: '\n'.join(props['ignored_exceptions'])"></textarea>
</td>
</tr>
<tr> <tr>
<td align="left" valign="top"> <td align="left" valign="top">
</td> </td>
...@@ -45,7 +56,7 @@ file(s). ...@@ -45,7 +56,7 @@ file(s).
</tr> </tr>
</table> </table>
<h3>Exception Log</h3> <h3>Exception Log (most recent first)</h3>
<div tal:define="entries container/getLogEntries"> <div tal:define="entries container/getLogEntries">
......
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