You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JsonConsoleFormatter: number and boolean properties should not be converted to string #39870
Currently the new JsonConsoleFormatter converts all the values of the key/value pairs in both the state and scopes to string.
As json supports numbers and booleans, I think the built-in value types should not be converted to string.
Using number would allow to write range queries once ingested on a log analysis system.
logger.LogInformation("This is a message with a {Number}",1);
Current result
{
"Timestamp": "2020-07-23T21:47:33.7369359\u002B01:00",
"EventId": 0,
"LogLevel": "Information",
"Category": "JsonLogging.Program",
"Message": "This is a message with a 1",
"Number": "1",
"{OriginalFormat}": "This is a message with a {Number}",
}
Expected result
{
"Timestamp": "2020-07-23T21:47:33.7369359\u002B01:00",
"EventId": 0,
"LogLevel": "Information",
"Category": "JsonLogging.Program",
"Message": "This is a message with a 1",
"Number": 1,
"{OriginalFormat}": "This is a message with a {Number}",
}
Activity
Dotnet-GitSync-Bot commentedon Jul 23, 2020
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
alefranz commentedon Jul 23, 2020
@maryamariyan if this change is agreed, I could work on a PR if it helps.
maryamariyan commentedon Jul 27, 2020
Sure. @alefranz go for it :)