What I have a NLog configuration file.
LoggingConfiguration nLogLoggingConfiguration;
Then
foreach (var target in nLogLoggingConfiguration.AllTargets)
{
I want to get the layout from the target, it seems in the memory. When I hover over it in the debugging time. I found:
What I want is
${message}|${exception:format=tostring}|${stacktrace}
Not all targets have layouts, so you have to get the items that inherit from
TargetWithLayout
, Then you can call ToString on the Layout object. An example: