NLog version: 4.5.6
Platform: .Net 4.5
I just ran into an issue/inconsistency using JSON formatted logs. It turns out that NaN, PositiveInfinity, and NegativeInfinity are not valid symbols for a double according to the JSON spec,
however, they serialize as symbols in the NLog JSON Serializer.
Example output:
"Segment": {
"Name": "Processing",
"Requested": "2018-06-14T23:06:43.9029798Z",
"Finished": "2018-06-14T23:07:20.2739469Z",
"Valid": true,
"EstimatedRemaining": NaN,
"Elapsed": 36.3709671
},
There's a lot of discussion about this in various places online. The common workarounds seem to be either converting it to a string ("NaN") or replacing it with null or 0.
The reason this is having an impact is that the deserializer used in our log aggregator doesn't recognize the log message as valid JSON and refuses to parse it.
Created PR #2861 @jkoplo Thank you for reporting this.
@jkoplo NLog 4.5.9 has been released: https://www.nuget.org/packages/NLog
Once again thank you for reporting this.