---
title: SAIF.Framework.Logging business rules
summary: Enumerated business rules with per-rule trigger, enforcement, and outcomes.
status: draft
owner: <owner>
last_reviewed: 2026-07-23
library: SAIF.Framework.Logging
reference_type: package
---

# SAIF.Framework.Logging business rules

This page captures business rules enforced by this library.

## BR-001: Audit logging is opt-in and disabled by default

| Field | Value |
| --- | --- |
| **Statement** | Audit logging is disabled by default and must be explicitly enabled by a hosting application before any audit record is produced. |
| **Trigger** | Any call to `AuditMessage`/`AuditCustomMessage`. |
| **Enforcement** | `clsLogAudit.IsEnabled` (Shared property, defaults `False`) is checked before any work is performed. |
| **Outcome** | No audit record is produced unless a caller explicitly sets `clsLogAudit.IsEnabled = True`. |
| **Confidence** | Verified |
| **Source** | `SAIF.Framework.Logging/clsLogAudit.vb` |

---

## BR-002: Trace logging is opt-in via flag or command-line switch, but functionally inert

| Field | Value |
| --- | --- |
| **Statement** | Trace logging can be gated on via a flag or command-line switch, but no trace data is ever actually written regardless of the gate state. |
| **Trigger** | Any call to `MethodBegin`/`MethodEnd`/`MethodMessage`. |
| **Enforcement** | `clsLogTrace.IsEnabled` (Shared flag) OR (non-web) command line containing `"TRACEON"` OR `UserTraceEnabled` (current user matches `TraceUser`) gate the call; however, the private `WriteMessage` sink is a no-op. |
| **Outcome** | Even when a caller enables tracing, no trace data is ever written to file or web service — the feature is deprecated in-place. |
| **Confidence** | Verified |
| **Source** | `SAIF.Framework.Logging/clsLogTrace.vb` |

---

## BR-003: File-based logging is prohibited in web applications

| Field | Value |
| --- | --- |
| **Statement** | Redirecting a logging class's output to a local file is prohibited when the caller is a web application. |
| **Trigger** | Any call to `ToFile()`/`ToFile(name)` on `clsLogAudit`, `clsLogError`, or `clsLogTrace`. |
| **Enforcement** | `If IsWeb Then Throw New ApplicationException("Logging to files not valid for web applications.")` |
| **Outcome** | Web applications must use the web-service sink (`wsLogging`); only non-web (WinForms/batch/console) apps may redirect logging to a local file. |
| **Confidence** | Verified |
| **Source** | `SAIF.Framework.Logging/clsLogAudit.vb`, `SAIF.Framework.Logging/clsLogError.vb`, `SAIF.Framework.Logging/clsLogTrace.vb` |

---

## BR-004: ASP.NET ViewState errors are never logged

| Field | Value |
| --- | --- |
| **Statement** | Exceptions identified as ASP.NET ViewState tampering/disconnect noise are dropped entirely rather than logged. |
| **Trigger** | `clsLogError.CreateError`/`CreateErrorWithEmail` is called with an exception whose formatted info contains ViewState-related text. |
| **Enforcement** | `clsLogError.SuppressLogging()` checks `ErrorInfo.ExceptionInfo` (uppercased) for `"AUTHENTICATION OF VIEWSTATE FAILED"` or `"INVALID_VIEWSTATE_CLIENT_DISCONNECTED"`. |
| **Outcome** | The error is dropped entirely (method returns `False`, no file/web-service write occurs). |
| **Confidence** | Verified |
| **Source** | `SAIF.Framework.Logging/clsLogError.vb` |

---

## BR-005: Logging failures must never raise exceptions to the caller

| Field | Value |
| --- | --- |
| **Statement** | A failure within any logging operation must never propagate as an exception to the calling application. |
| **Trigger** | All logging entry points. |
| **Enforcement** | Every logging operation body (or its private write helpers) is wrapped in `Try...Catch` with an empty/`'gobble gobble` catch block, silently swallowing failures (SOAP call failures, file I/O errors, reflection errors, etc.). |
| **Outcome** | Application logging is best-effort; a failure to log (e.g., web service unreachable) never causes the calling application to fail. |
| **Confidence** | Verified |
| **Source** | `SAIF.Framework.Logging/clsLogAudit.vb`, `SAIF.Framework.Logging/clsLogError.vb`, `SAIF.Framework.Logging/clsLogTrace.vb`, `SAIF.Framework.Logging/clsLoginLog.vb` |

---

## BR-006: Email error notification always sent to a fixed corporate email domain

| Field | Value |
| --- | --- |
| **Statement** | The "from" address used for error-notification email always resolves to the `@SAIF.COM` domain. |
| **Trigger** | `clsLogError.CreateErrorWithEmail` is called. |
| **Enforcement** | The sender address is hard-coded as `LogError.ErrorInfo.Username & "@SAIF.COM"`. |
| **Outcome** | The notification email's sender/reply convention always resolves usernames to the `@SAIF.COM` domain. |
| **Confidence** | Verified |
| **Source** | `SAIF.Framework.Logging/clsLogError.vb` |

---

## BR-007: Queue name/server resolution falls back to hard-coded defaults

| Field | Value |
| --- | --- |
| **Statement** | MSMQ queue server/name resolution always yields a workable value, even when configuration is missing. |
| **Trigger** | `clsLoggingQueues.QueueServer`/`QueueName` accessed and the corresponding AppSettings key is absent/empty. |
| **Enforcement** | Property getters check `ConfigurationManager.AppSettings.Item(...)` and fall back to `"MQPROD"` (server) / `"logging"` (queue name) constants. |
| **Outcome** | Queue path resolution never fails due to missing configuration; a workable default queue is always returned. |
| **Confidence** | Verified |
| **Source** | `SAIF.Framework.Logging/clsLoggingQueues.vb` |

---

## Notes
- `SAIF.Framework.Logging` performs no database interactions, so no rules in this set involve `Tables`/`SQL` fields.
- Rules [BR-003](#br-003-file-based-logging-is-prohibited-in-web-applications) and [BR-005](#br-005-logging-failures-must-never-raise-exceptions-to-the-caller) apply uniformly across `clsLogAudit`, `clsLogError`, and `clsLogTrace`.

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Dependencies](dependencies.md)
- [Operations and processes](operations-processes.md)
- [Configuration](configuration.md)
- [API reference](api/index.md)

## Sources
- `SAIF.Framework.Logging/clsLogAudit.vb`
- `SAIF.Framework.Logging/clsLogError.vb`
- `SAIF.Framework.Logging/clsLogTrace.vb`
- `SAIF.Framework.Logging/clsLoginLog.vb`
- `SAIF.Framework.Logging/clsLoggingQueues.vb`
