Skip to content

Feature/2 logging abstractions - #5

Merged
dgates82 merged 6 commits into
mainfrom
feature/2-logging-abstractions
Jul 17, 2026
Merged

Feature/2 logging abstractions#5
dgates82 merged 6 commits into
mainfrom
feature/2-logging-abstractions

Conversation

@dgates82

Copy link
Copy Markdown
Owner

Demonstrates DGates.AwsSecretsManager's ILogger integration against two different frameworks:

  • ConsoleExample — custom synchronous ILoggerProvider, avoiding
    Microsoft.Extensions.Logging.Console's async queue so log output stays correctly
    interleaved with the demo's step-by-step narration
  • MvcExample — NLog, bridged into the library via NLogLoggerProvider and unified with the
    app's own logging (WeatherController, Global.asax.cs, SecretsManagerAccessor), replacing
    the previous System.Diagnostics.Trace calls

Bumps DGates.AwsSecretsManager to 1.0.0-beta.3.

dgates82 added 6 commits July 16, 2026 14:29
- add SyncConsoleLoggerProvider/SyncConsoleLogger in Logging/, writing
  synchronously to Console.Out to avoid Microsoft.Extensions.Logging.Console's
  async queue, which caused log output to interleave out of order with
  Program's own narration
- wire logger into SecretsManagerServiceFactory.Create via
  ILoggerFactory.SetMinimumLevel(Debug), demonstrating a fully custom,
  non-Microsoft ILogger consumed by the library
- restructure demo sequence to insert a fetch between InvalidateCache and
  RefreshSecretAsync, so each step's log output actually proves its
  narration (invalidate clearing the cache, refresh bypassing a warm cache)
  rather than asserting it
- remove hardcoded "[cache hit]" console message, now redundant with the
  library's real Debug-level cache-hit log
- add NLog.Extensions.Logging to MvcExample.Infrastructure; bridge
  NLogLoggerProvider -> ILogger in SecretsManagerAccessor.Initialize(),
  passed into SecretsManagerServiceFactory.Create
- add nlog.config (File + Debugger targets, minlevel=Debug)
- add one Log.Info call in WeatherController.Index(cityName) as a
  smoke test for the wiring
…rosoft.Extensions.* versions

  - Library now floors Microsoft.Extensions.Logging.Abstractions at 8.0.0
    instead of hard-requiring 10.0.10, so it no longer forces a version
    split against NLog.Extensions.Logging's net48-compatible dependency
    set (which only offers the 8.x generation)
  - Confirmed via the built assemblies: every Microsoft.Extensions.* DLL
    and System.Diagnostics.DiagnosticSource now resolve to a single
    consistent 8.0.0.0 — no binding redirects needed for this cluster
  - Add <extensions><add assembly="NLog.Web"/></extensions> to
    nlog.config so NLog registers NLog.Web's layout renderers
    (${aspnet-appbasepath}) instead of failing to parse the config
  - Replace Trace.TraceError with Log.Error(ex, "...") using NLog's
    exception-first pattern and structured placeholders, consistent
    with the existing Log.Info call in WeatherController
  - Wire up a Logger in Global.asax.cs for the Application_Start
    init-failure case
…Accessor.Initialize()

- add a dedicated NLog.Logger to SecretsManagerAccessor (GetCurrentClassLogger,
  same pattern as WeatherController/Global.asax.cs), distinct from the ILogger
  bridge passed into SecretsManagerServiceFactory.Create, which is scoped to
  SecretsManagerService specifically
- log the resolved backend source (AWS/LocalStack/local fallback) and, when
  set, the resolved absolute LocalJsonFallbackPath, before the service is
  constructed — surfaces the accessor's own startup decisions in the log
  rather than only becoming visible via the "how this worked" panel on
  first request
- resolved path logging specifically targets the IIS working-directory
  fallback-path bug already documented in ResolveLocalJsonFallbackPath
@dgates82
dgates82 merged commit aaac20d into main Jul 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant