datalust/seq-client-log4net

NLog 4.5 structured logging - every structured parameter is written twice to the output

olibanjoli opened this issue · 1 comments

Hi

We upgraded to the latest NLog 4.5 (rc05) and noticed an issue when using the new structured logging feature.

// some structured logging
Log.Info("Searching for {Query}", "foo");

https://github.com/datalust/seq-client/blob/a4aa67f0e4b516724499a0383b4461b38add2cc9/src/Seq.Client.NLog/Client/NLog/LogEventInfoFormatter.cs#L118-L124

These lines write the values of the structured Parameters index based. But in NLog 4.5 those values are already written by NLog itself using their name. So in that case it is Query. So we have foo twice in the output, as Query and as 0.

I don't know the use case behind these lines. When do you want those values with the name being their index position? Maybe this if statement can be skipped when structured logging is on (which is by default in NLog 4.5). I'm sure you know better.

So currently every structured parameter will end up twice in seq.

https://github.com/NLog/NLog/wiki/How-to-use-structured-logging

Hi @olibanjoli - thanks for the report.

We're in the process of writing a new NLog target to suit NLog 4.5 - you can check out progress in: https://github.com/datalust/nlog-targets-seq

There's one small issue preventing a really good integration with NLog 4.5-rc05, we're waiting on a bug fix that should be included in 4.5-rc06, then I think it'll be ready to put through some more rigorous testing (you can track this by following the PR at https://github.com/datalust/nlog-targets-seq).

Stay tuned! :-)