Issue Details (XML | Word | Printable)

Key: LOG4NET-107
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Ron Grabowski
Reporter: Drew Schaeffer
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Log4net

[PATCH] Added ExceptionEvaluator

Created: 18/Dec/06 06:21 PM   Updated: 14/Jun/08 02:23 PM
Return to search
Component/s: Core
Affects Version/s: 1.2.10
Fix Version/s: 1.2.11

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works ExceptionEvaluator.cs 2006-12-18 06:24 PM Drew Schaeffer 4 kB
File Licensed for inclusion in ASF works patch-file.diff 2006-12-18 06:23 PM Drew Schaeffer 5 kB
Issue Links:
Reference
 

Resolution Date: 21/Dec/06 01:34 AM


 Description  « Hide
Added an ExceptionEvaluator class to allow buffered appenders to trigger based on the type of LoggingEvent.ExceptionObject. By setting the TiggerOnSubclass property the evaluator will trigger on types that are of the same type or subclasses of ExceptionType.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Drew Schaeffer added a comment - 18/Dec/06 06:23 PM
built against svn revision 488382

Drew Schaeffer added a comment - 18/Dec/06 06:24 PM
ExceptionEvaluator.cs adds an evaluator that allows buffered appenders to be triggered based on the type of LoggingEvent.ExceptionObject

Ron Grabowski added a comment - 20/Dec/06 04:36 AM
Why isn't ExceptionType of type Exception:

/// <summary>
/// The type that triggers this evaluator.
/// </summary>
public Exception ExceptionType
{
get { return m_type; }
set { m_type = value; }
}

We know from the Exception property on LoggingEvent that the type must be at least Exception.

+1 for making the signature "public Exception ExceptionType".

Drew Schaeffer added a comment - 20/Dec/06 03:51 PM
It seemed intuitive to make ExceptionType of type Type. Otherwise, when creating an ExceptionEvaluator you would have to set ExceptionType to an instance of the type of exception you want to trigger on. ie

ExceptionEvaluator eval = new ExceptionEvaluator();
eval.ExceptionType = new ApplicationException();

This would certainly work but ExceptionEvaluator.IsTriggeringEvent would still be comparing the type. ie

m_type.GetType() == loggingEvent.ExceptionObject.GetType()

So if the type of exception is what is being compared why not have ExceptionType be of type Type?

Ron Grabowski added a comment - 20/Dec/06 07:54 PM
Doh! You're absolutely correct. I must have been thinking about something else when I wrote that.

Ron Grabowski added a comment - 21/Dec/06 01:34 AM
Fixed in r489241: Added ExceptionEvaluator that triggers a BufferingAppenderSkeleton to flush its buffer when a certain Exception is detected.