Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

13
  • Logging pre-dates string interpolation. Commented Sep 6, 2018 at 9:10
  • 1
    Who nose? Probably because they want to provide support for people not on C# 6? And because existing logging frameworks have that params object[] overload? Commented Sep 6, 2018 at 9:10
  • 1
    String interpolation does work, as long as there's an ID property or variable in context. Of course, that means that you lose all information about context, properties, variables etc and have only that one string that needs parsing to find out what it contains. Commented Sep 6, 2018 at 9:12
  • 1
    You asked two question (or three). 1) Why not log only strings? Because the parameters matter, because the string is actually just a description and the real actionable information is part of the category, event, severity, correlation parameters. Logging frameworks can use that information to select targets, message strings etc. Semantic logging also uses them Commented Sep 6, 2018 at 9:14
  • 1
    Here's a solution to use string interpolation with Serilog and not to lose structured logging benefits. Commented May 15, 2020 at 10:19