logging literal { } in a message using serilog and also have parameters

Viewed 55

We have some old logging that is using serilog and logging json "My log message {"Test" : "TestValue"}" literally.

We want to expand the logging with args. So we can provide

"My log message {"Test" : "TestValue"}, {@json2}", json2

we cannot refactor all the code where we have this potential issue.

Is there any way to ensure that all existing json in a message passes as literal and not with substitution?

I have tried with;

"My log message {{"Test" : "TestValue"}}, {@json2}", json2
"My log message {$"Test" : "TestValue"}, {@json2}", json2
"My log message \{"Test" : "TestValue"\}, {@json2}", json2

all doest not seem to work :-(

0 Answers
Related