Skip to content

feat(bootstrap): lifecycle logging with AppName, versions and registration summary#46

Merged
tgiachi merged 4 commits into
developfrom
feature/lifecycle-logging
Jul 3, 2026
Merged

feat(bootstrap): lifecycle logging with AppName, versions and registration summary#46
tgiachi merged 4 commits into
developfrom
feature/lifecycle-logging

Conversation

@tgiachi

@tgiachi tgiachi commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

The bootstrap was silent: nothing on service start, nothing on shutdown, no trace of registrations, and a start failure propagated without naming the service. Now the whole lifecycle is logged:

MyApp 1.0.0 starting (SquidStd 0.15.0, config myapp, root /srv/myapp)
Registered 7 lifecycle service(s), 5 config section(s), 25 container registration(s)
Started JobSystemService in 2.6ms
MyApp started: 5 service(s) in 30.1ms
...
MyApp stopping (5 service(s))
Stopped MetricsCollectionService
MyApp shutdown complete
  • SquidStdOptions.AppName (defaults to the entry assembly name) + app/SquidStd versions from InformationalVersion; attached to every event as Application/ApplicationVersion enrichment.
  • Logger configured before the service loop (was mid-loop after the config manager - earlier services' logs were dropped by the silent logger).
  • Registration summary: Information counts + Debug detail (lifecycle services with priorities, config sections, full DryIoc container snapshot grouped by assembly) - zero changes to the 38 registration extensions, all read from already-tracked data.
  • Per-service start with duration; a failing start logs an Error naming the service, then rethrows.
  • Shutdown with continue-on-error: a failing StopAsync logs a Warning and the remaining services are still stopped (was: aborted the loop, leaving them running); cancellation still rethrows.
  • Container-provided sinks: ILogEventSink instances registered in the container are attached to the bootstrap logger (extension point + what makes these tests possible).
  • Docs paragraph in the bootstrap-lifecycle concept.

Follow-ups noted (out of scope)

  • Pre-existing double-start: StartAsync called twice re-starts every service (the GettingStarted sample does StartAsync + RunAsync); MarkStarting should guard it.
  • Stop-cancel leaves remaining services unstoppable (state already Stopped); acceptable, documented behavior.

Test Plan

  • 7 lifecycle tests (banner/enrichment, AppName default+override, registrations, per-service, pre-config-manager priority capture, failure Error + rethrow, stop continue-on-error, shutdown complete)
  • Full suite 1011/1011; build 0 errors, 0 new warnings; docfx 0 warnings
  • Manual smoke on a file-based app: full lifecycle visible in console
  • No BREAKING markers in commits (expected release: 0.16.0)

@tgiachi
tgiachi merged commit dd69615 into develop Jul 3, 2026
2 of 3 checks passed
Comment on lines +262 to +265
catch (Exception ex)
{
logger.Warning(ex, "Service {Service:l} failed to stop", service.GetType().Name);
}
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.

2 participants