Serilog¶
Serilog is the preferred structured logging provider for ConnectSoft service templates when rich JSON logs, request logging, enrichment, and downstream log analytics are required.
Use Cases¶
- structured application logs;
- request logging with correlation;
- tenant, user, module, and environment enrichment;
- JSON console logs for containers;
- file or external sinks for local and hosted environments;
- integration with OpenTelemetry traces and metrics through shared correlation IDs.
ConnectSoft Guidance¶
- Prefer structured properties over string interpolation.
- Include correlation identifiers in request, background job, messaging, and actor logs.
- Redact secrets, tokens, cookies, credentials, and sensitive domain data before logs leave the process.
- Keep provider-specific sink setup in template implementation docs.
- Keep canonical logging guidance in Logging.
Template Responsibilities¶
BaseTemplate should document:
- bootstrap logger setup;
- registration methods;
- appsettings sections;
- package references;
- request logging middleware;
- tests and troubleshooting.
Layer 3 templates should document only deltas, such as disabled Serilog support, additional enrichers, or domain-specific sink choices.