clsLogError¶
clsLogError is the exception-logging entry point for hosting applications, capturing exception detail and ambient context, suppressing noisy ASP.NET ViewState errors, and optionally emailing a recipient when an error is logged.
Purpose¶
- Record application exceptions (with recursive inner-exception formatting) to either a local CSV file or the remote
wsLoggingSOAP web service. - Suppress ASP.NET ViewState tampering/disconnect errors before they are written (see BR-004).
- Optionally notify a recipient by email when an error occurs.
Context¶
- Namespace:
SAIF.Framework.Logging - Assembly/package:
SAIF.BOF.Framework.Logging(SAIF.Framework.Logging/SAIF.BOF.Framework.Logging.vbproj) - Class is
Serializable.
Public members¶
| Member | Signature | Purpose |
|---|---|---|
New |
Public Sub New(exception As Exception, ParamArray stateInfo() As Object) |
Constructs an instance, capturing exception detail and ambient context, including recursive inner-exception formatting (ExceptionToString). |
ErrorInfo |
ReadOnly Property ErrorInfo As ErrorInfoStruct |
Exposes the populated ErrorInfoStruct context struct for the constructed instance. |
CreateError |
Shared Function CreateError(exception As Exception, ParamArray stateInfo() As Object) As Boolean |
Primary entry point: constructs a clsLogError, checks SuppressLogging(), and writes the error unless suppressed. |
CreateErrorWithEmail |
Shared Function CreateErrorWithEmail(sendTo As String, exception As Exception, ParamArray stateInfo() As Object) As Boolean |
Same as CreateError, plus sends an email notification via SAIF.Framework.Mail.SAIFMail.clsSAIFMessage.SendMail. |
SuppressLogging |
Function SuppressLogging() As Boolean |
Returns True if ErrorInfo.ExceptionInfo matches known ASP.NET ViewState noise patterns, suppressing the write. |
ToFile |
Shared Sub ToFile() |
Redirects subsequent error writes to a local CSV file (throws if IsWeb; see BR-003). |
ToFile |
Shared Sub ToFile(fileName As String) |
Same as ToFile(), using a caller-supplied file name. |
Behavioral notes¶
GetBasicErrorInfo()gathers ambient context (machine name, application name, page name, environment, current username) viaclsSecurityPrincipal(fromSAIF.Framework.Security)*.WriteMessagedispatches to a local file sink (ifToFile()was previously called) or, by default, to thewsLogging.clsWSLogging.WriteErrorSOAP operation.CreateErrorWithEmailbuilds aclsSAIFMessage, sets itsUrlfrom thelegacyMailServiceUrlconfig setting, and always uses"{username}@SAIF.COM"as the sender address (see BR-006).- All write paths are wrapped in
Try...Catchwith empty/'gobble gobblecatch blocks, so a failure to log never propagates to the caller (see BR-005).
Constraints and usage notes¶
ToFile()/ToFile(fileName)must not be called from a web application; doing so throwsApplicationException("Logging to files not valid for web applications.").- Errors whose formatted exception info contains
"AUTHENTICATION OF VIEWSTATE FAILED"or"INVALID_VIEWSTATE_CLIENT_DISCONNECTED"are silently dropped and never written. CreateErrorWithEmaildepends onSAIF.Framework.Mail; the primaryCreateErrorpath does not.
Note: Statements marked with
*were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with**could not be confirmed; treat as unknown until verified.
Related documentation¶
Sources¶
SAIF.Framework.Logging/clsLogError.vbSAIF.Framework.Logging/ErrorInfoStruct.vb