Aller au contenu

Structured logging (ARCH1002)

Ce contenu n’est pas encore disponible dans votre langue.

Key dotnet.logging.structured-logging · Severity warning · Category logging

Logs built with string interpolation or concatenation do not produce searchable fields. Use structured logging with named placeholders.

_logger.LogInformation("Order " + orderId + " processed, amount: " + amount);
_logger.LogInformation("Order {OrderId} processed, amount: {Amount}", orderId, amount);

Move variables into named {Placeholder} tokens in the message template and pass them as arguments.