Logging with context

While it is important not to create too much "noise", it is equally important to make sure that the logs provide enough information to identify the course of the event or the source of the error. Every software engineer has encountered a message along the lines of "A fatal error has occurred", and knows how much more difficult debugging can get, when there is nothing to narrow down the potential error cause. If an event is important enough to log, you should strive to provide enough information about it with the assumption that the log might be read and analyzed by a different team member.

When logging, include the event description, event trigger, and other relevant bits of information, such as user ID, document name, ...

Get Serverless computing in Azure with .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.