I am using the NLogTraceListener
which I found here.
It is defined in my config file as follows:
<sharedListeners>
<add name="nlog" type="NLog.NLogTraceListener, NLog" traceOutputOptions="Callstack" />
</sharedListeners>
And here is the LayoutRenderer in the nlog.config file:
layout="${longdate} ${logger} ${uppercase:${level}} ${threadid} ${message} ${exception:format=tostring}"
And here is the sample output of an error to the log file:
2018-08-07 06:37:46.3350 System.Net.Sockets ERROR 200 [16956] Exception in Socket#8977203::Connect - An operation was attempted on something that is not a socket 23.96.28.38:443.
How do I get my layout to include the traceOutputOptions
(in this case, the callStack)
There is no support for traceOutputOptions
in NLogTraceListener
.
Instead you just configure the layout to include the ${callsite}
.
Example:
layout="${longdate} ${logger} ${uppercase:${level}} ${threadid} ${message} ${exception:format=tostring} ${callsite}"
See the Wiki for how to configure output options: https://github.com/NLog/NLog/wiki/Callsite-layout-renderer