Skip to content

Logging structured data without it appearing in the text message #35995

@roji

Description

@roji

Am looking for some guidance here, or at least confirmation that I understand things right...

Currently, if I want to use the extension methods (e.g. LogDebug), it seems that in order to log some piece of structured data it must be referenced from the message - this seems problematic in several scenarios.

First, when using a logging framework such as NLog, it is standard practice to leave the layout of the text message to NLog (user-configurable). Requiring me to embed all structured data in the message text hands off a fully-formed message to NLog, stripping it of one of it's main responsibilities (layouting).

Also, in many scenarios there's a lot of structured context that may be interesting to users in some cases, but that doesn't mean it's always interesting and should get included in the text of each and every message. This causes very large log messages with clutter and info nobody really wants (although people may still want the option of looking up these details in the structured data attached to the message).

I understand that I don't have to use the extension methods and can roll my own, but I'd like confirmation to the above, and also your opinion on this.

Metadata

Metadata

Assignees

Labels

area-Extensions-LoggingquestionAnswer questions and provide assistance, not an issue with source code or documentation.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions