By default when logging messages through ILogger
only objects that have a placeholder in the message template are logged. For example, when executing the following line of code:
the following information is logged:
This is something that you can also notice when you check the warning you get when hovering over the message:
But what if you want to log these extra properties?
One way to get this done is by using scopes to add custom properties. Typically this is used for multiple log entries, but it also works for single log statements:
More information: