liveBook · Manning

Support logging

As explained in Unit Testing Principles, Practices, and Patterns

Support logging produces messages intended for support staff or system administrators to monitor application behavior.

Support logging produces messages for support staff and system administrators. Unlike diagnostic logging, it is part of the application's observable behavior when stakeholders require it. section 8.6 section 8.8

Treat support logging as functionality that uses an out-of-process dependency. Test interactions with log storage, but verify them through an explicit DomainLogger rather than directly mocking ILogger. section 8.6 section 8.8

Extract a business logging operation

Instead of embedding a raw message in User.ChangeEmail, call _domainLogger.UserTypeHasChanged(UserId, oldType, newType). DomainLogger then translates that named operation into an ILogger message, giving tests a stable business-facing interaction.

When support logging represents a domain change, record a domain event in the model and convert it into a DomainLogger call in the controller. Keep diagnostic logging separate and use it sparingly. section 8.8

Inject loggers explicitly through constructors or method arguments. Avoid static logger fields, which hide dependencies and make interactions less explicit.

How Unit Testing Principles, Practices, and Patterns covers it

How deep it goes
Explains classification, testing boundaries, DomainLogger extraction, domain-event integration, and explicit dependency injection.
Examples
Uses user email changes, user-type transitions, DomainLogger wrappers, domain events, static logger fields, and injected ILogger arguments.
What it assumes
Assumes familiarity with application layers, mocks, out-of-process dependencies, and domain events; distinguishes support logging from diagnostic logging.
What you can do after
Evaluate/understand which logs are observable requirements, then test support interactions through an explicit logging abstraction.
How it connects
Connects support logging with diagnostic logging, integration testing, out-of-process dependencies, DomainLogger, domain events, and dependency injection.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Unit Testing Principles, Practices, and Patterns. The section links point to the parts of the book it draws on.