My config looks like this. However sometimes the ${message} itself is a json object and when it is outputted, all the double quotes get escaped by the backslash. Is there a way to output the json message just like a json string? I'm using the package NLog.Web.AspNetCore.
<target name="fileTarget" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard">
<target xsi:type="File" fileName="${logDirectory}/dotnetapp.log"
archiveFileName="${logDirectory}/archives/{#}.log"
archiveEvery="Day" archiveNumbering="Date" maxArchiveFiles="4">
<layout xsi:type="JsonLayout">
<attribute name="date" layout="${longdate}" />
<attribute name="log-level" layout="${level:uppercase=true}" />
<attribute name="logger" layout="${logger}" />
<attribute name="trace-id" layout="${aspnet-Traceidentifier}" />
<attribute name="message" encode="false">
<layout xsi:type="JsonLayout">
<attribute name="body" escapeUnicode="false" layout="${message}" />
<attribute name="ex" layout="${exception:format=tostring}" />
</layout>
</attribute>
</layout>
</target>
</target>
My config looks like this. However sometimes the ${message} itself is a json object and when it is outputted, all the double quotes get escaped by the backslash. Is there a way to output the json message just like a json string? I'm using the package NLog.Web.AspNetCore.