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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.