Currently, we have NLog spitting out CSV files just to prove we have NLog actually logging exceptions.
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" internalLogToConsole="true" internalLogToConsoleError="true">
<targets>
<target name="file" xsi:type="File" fileName="${specialfolder:folder=ApplicationData}/log.csv">
<layout xsi:type="CSVLayout">
<column name="User_Machine_Name" layout="${machinename}" />
<column name="Time" layout="${date}" />
<column name="Level" layout="${level}" />
<column name="Message" layout="${message}" />
<column name="Exception_Message" layout="${exception:format=Message}"/>
<column name="Exception_Type" layout="${exception:format=Type}"/>
<column name="Callsite_Class" layout="${callsite:methodName=false}" />
<column name="Callsite_Method" layout="${callsite:className=false}" />
<column name="Stack_Trace" layout="${stacktrace:format=DetailedFlat}"/>
</layout>
</target>
<target name="console" xsi:type="Console"
layout="${longdate}|${level}|${message}">
</target>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="file" />
</rules>
This is working as expected except that I need it to output in XML. I've looked through NLog documentation and the only thing I've found is that there's a Log4JXmlEventLayout but the documentation doesn't go into how to use it. I'm new to NLog and I can't find too many resources on the subject.