mdlLogging¶
mdlLogging is a shared VB Module that centralizes log4net-backed logging for the library. It exposes a lazily-initialized Log instance and convenience methods that format each message with request/host context before writing it, and is consumed by every authenticator class in the library (for example, clsSecurityModule.AuthRequest_Handler).
Purpose¶
- Provide a single, shared
log4netlogger instance for the library, keyed by theclsSecurityModuletype name. - Standardize log message formatting to include the requesting host address, request URL, application name, and call-stack context alongside the caller-supplied message.
Context¶
- Namespace:
SAIF.Framework.SecurityModule - Assembly/package:
SAIF.Framework.SecurityModule(packaged inside theSAIF.BOF.FrameworkNuGet package)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
Log |
Public ReadOnly Property Log As ILog |
Lazily creates (on first access) and returns a log4net.ILog instance obtained via LogManager.GetLogger(GetType(clsSecurityModule).Name); subsequent calls reuse the cached instance. |
LogInfo |
Public Sub LogInfo(msg As String) |
Formats and writes msg at log4net Info level via Log.InfoFormat. |
LogWarn |
Public Sub LogWarn(msg As String) |
Formats and writes msg at log4net Warn level via Log.WarnFormat. |
LogError |
Public Sub LogError(msg As String) |
Formats and writes msg at log4net Error level via Log.ErrorFormat. |
LogDebug |
Public Sub LogDebug(msg As String) |
Formats and writes msg at log4net Debug level via Log.DebugFormat. |
Behavioral notes¶
- Every log call is routed through the private
LogMsghelper, which builds a comma-separated parameter list: client host address, current request URL, application path (leading/stripped), a synthesized call-stack trail, and the caller's message. - The call-stack trail (
GetStackFrames) walks the current stack, keeping only frames declared onclsSecurityModule, reverses the order, and excludes frames whose method name starts withASSERTorGETSTACKFRAMES, joining the remaining names with->. - Because
GetHostAddress/GetRequestURL/LogMsgread fromSystem.Web.HttpContext.Current.Request, all public logging methods require an active ASP.NET request context; calling them outside a request pipeline would raise a null-reference exception.*
Constraints and usage notes¶
- All public members are module-level (shared);
mdlLoggingis not intended to be instantiated. - The underlying
log4netlogger name is alwaysclsSecurityModule, regardless of which class in the library invokesLogInfo/LogWarn/LogError/LogDebug.
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. Statements marked with † were retrieved from dependency library documentation via the Legends CLI RAG service. They describe inherited behavior from the indicated origin library and should be verified if the dependency version changes.
Sources¶
SAIF.Framework.SecurityModule\mdlLogging.vb