<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
      autoReload="true"
      throwExceptions="false"
      internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">

	<variable name="basedir" value="${basedir}" />
	<variable name="varDataFolderPath" value="${var:basedir}/Logs" />
	<variable name="varLayHeader" value="${longdate}|${level}" />
	<variable name="varLayMiddle" value="${callsite-linenumber}|${callsite:includeSourcePath=false:methodName=false}" />
	<variable name="varLayBack" value="${message}|${exception:format=toString}" />

	<targets>

		<target name="csv" xsi:type="File" fileName="${var:basedir}/file.csv">
			<layout xsi:type="CSVLayout">
				<column name="time" layout="${shortdate}" />
				<column name="message" layout="${message}" />
				<column name="logger" layout="${logger}" />
				<column name="level" layout="${level}" />
			</layout>
		</target>

		<target name="ExceptionFile"
			xsi:type="File"
			encoding="utf-8"
			maxArchiveFiles="100"
			archiveEvery="Day"
			archiveNumbering="Date"
			archiveDateFormat="yyyyMMdd"
			archiveFileName="${varDataFolderPath}/archives/log.{#}.txt"
			fileName="${varDataFolderPath}/${date:format=yyyy-MM-dd}/ExceptionLog.txt"
			layout="${varLayHeader}|${varLayMiddle}|${varLayBack}" />

		<target xsi:type="Console"
				name="logConsole"
				layout="${varLayHeader}|${varLayMiddle}|${varLayBack}" />
	</targets>

	<rules>
		<logger  name="*"   writeTo="csv" />
		<logger  name="*"   writeTo="ExceptionFile" />
		<logger  name="*"   writeTo="logConsole" />
	</rules>
</nlog>