-
Notifications
You must be signed in to change notification settings - Fork 830
Description
Description
When using JsonFormatter with renderMessage enabled to write console output, the JSON output is not created correctly and results in invalid JSON.
Reproduction
- Configure a default logger with a sinkConfiguration that uses the JsonFormatter with renderMessage = true
- Log a message
- The output results in invalid quoted JSON at the renderedMessage with an extra quote, for example:
{ "Timestamp": "2023-06-21T09:48:56.0952245+02:00", "Level": "Error", "MessageTemplate": "Testmessage with value: {TestMessageValue}"", "RenderedMessage": "Testmessage with value: 1", "Properties": { "TestMessageValue": "1" } }
Expected behavior
Using Serilog 2.12.0 the output would result in valid JSON, we would expect the same behaviour in the latest version.
Relevant package, tooling and runtime versions
Serilog 3.0.0
Additional context
Code where the extra quote is added can be found here:
https://github.com/serilog/serilog/blob/main/src/Serilog/Formatting/Json/JsonFormatter.cs#L69