Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.10
    • Fix Version/s: 1.2.11
    • Component/s: Core
    • Labels:
      None

      Description

      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.

      1. patch-file.diff
        5 kB
        Drew Schaeffer
      2. ExceptionEvaluator.cs
        4 kB
        Drew Schaeffer

        Issue Links

          Activity

          Drew Schaeffer created issue -
          Hide
          Drew Schaeffer added a comment -

          built against svn revision 488382

          Show
          Drew Schaeffer added a comment - built against svn revision 488382
          Drew Schaeffer made changes -
          Field Original Value New Value
          Attachment patch-file.diff [ 12347439 ]
          Hide
          Drew Schaeffer added a comment -

          ExceptionEvaluator.cs adds an evaluator that allows buffered appenders to be triggered based on the type of LoggingEvent.ExceptionObject

          Show
          Drew Schaeffer added a comment - ExceptionEvaluator.cs adds an evaluator that allows buffered appenders to be triggered based on the type of LoggingEvent.ExceptionObject
          Drew Schaeffer made changes -
          Attachment ExceptionEvaluator.cs [ 12347440 ]
          Ron Grabowski made changes -
          Assignee Ron Grabowski [ ron ]
          Hide
          Ron Grabowski added a comment -

          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".

          Show
          Ron Grabowski added a comment - 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".
          Hide
          Drew Schaeffer added a comment -

          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?

          Show
          Drew Schaeffer added a comment - 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?
          Hide
          Ron Grabowski added a comment -

          Doh! You're absolutely correct. I must have been thinking about something else when I wrote that.

          Show
          Ron Grabowski added a comment - Doh! You're absolutely correct. I must have been thinking about something else when I wrote that.
          Drew Schaeffer made changes -
          Link This issue is related to LOG4NET-108 [ LOG4NET-108 ]
          Hide
          Ron Grabowski added a comment -

          Fixed in r489241: Added ExceptionEvaluator that triggers a BufferingAppenderSkeleton to flush its buffer when a certain Exception is detected.

          Show
          Ron Grabowski added a comment - Fixed in r489241: Added ExceptionEvaluator that triggers a BufferingAppenderSkeleton to flush its buffer when a certain Exception is detected.
          Ron Grabowski made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Ron Grabowski made changes -
          Fix Version/s 1.2.11 [ 12310980 ]
          Affects Version/s 1.2.10 [ 11128 ]

            People

            • Assignee:
              Ron Grabowski
              Reporter:
              Drew Schaeffer
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development