Skip to content

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 log4net logger instance for the library, keyed by the clsSecurityModule type 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 the SAIF.BOF.Framework NuGet 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 LogMsg helper, 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 on clsSecurityModule, reverses the order, and excludes frames whose method name starts with ASSERT or GETSTACKFRAMES, joining the remaining names with ->.
  • Because GetHostAddress/GetRequestURL/LogMsg read from System.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); mdlLogging is not intended to be instantiated.
  • The underlying log4net logger name is always clsSecurityModule, regardless of which class in the library invokes LogInfo/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