Loupe - Log - Monitor - Resolve
Gibraltar.Monitor Namespace / Log Class / RecordException Method / RecordException(IMessageSourceProvider,Exception,String,String,Boolean) Method
An IMessageSourceProvider object which supplies the source information about this log message (NOT the exception source information).
An Exception object to record as a log message. This call is ignored if null.
Optional. An XML document with extended details about the exception. Can be null.
The application subsystem or logging category that the message will be associated with.
True if the application can continue after this call, false if this is a fatal error and the application can not continue after this call.

In This Topic
    RecordException(IMessageSourceProvider,Exception,String,String,Boolean) Method
    In This Topic
    Record an unexpected Exception to the Gibraltar central log, formatted automatically.
    Syntax
    'Declaration
     
    
    Public Overloads Shared Sub RecordException( _
       ByVal sourceProvider As IMessageSourceProvider, _
       ByVal exception As Exception, _
       ByVal detailsXml As String, _
       ByVal category As String, _
       ByVal canContinue As Boolean _
    ) 
    public static void RecordException( 
       IMessageSourceProvider sourceProvider,
       Exception exception,
       string detailsXml,
       string category,
       bool canContinue
    )

    Parameters

    sourceProvider
    An IMessageSourceProvider object which supplies the source information about this log message (NOT the exception source information).
    exception
    An Exception object to record as a log message. This call is ignored if null.
    detailsXml
    Optional. An XML document with extended details about the exception. Can be null.
    category
    The application subsystem or logging category that the message will be associated with.
    canContinue
    True if the application can continue after this call, false if this is a fatal error and the application can not continue after this call.
    Remarks

    This method provides an easy way to record an Exception as a separate message which will be attributed to the code location which threw the Exception rather than where this method was called from. The category will default to "Exception" if null, and the message will be formatted automatically based on the Exception. The severity will be determined by the canContinue parameter: Critical for fatal errors (canContinue is false), Error for non-fatal errors (canContinue is true).

    This method is intended for use with top-level exception catching for errors not anticipated in a specific operation, but when it is not appropriate to alert the user because the error does not impact their work flow or will be otherwise handled gracefully within the application. For unanticipated errors which disrupt a user activity, see the ReportException method.

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also