<?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">

	<!-- optional, add some variables
  https://github.com/nlog/NLog/wiki/Configuration-file#variables
  -->

	<variable name="Layout" value="${longdate} | ${level:uppercase=true} | ${logger} | ${message} ${newline}"/>
	<variable name="LayoutFatal" value="${longdate} | ${level:uppercase=true} | ${logger} | ${message} | ${exception:format=tostring} ${newline}"/>

	<!--[變數] 檔案位置 -->
	<variable name="LogTxtDir" value="${basedir}/App_Data/Logs/${shortdate}/"/>
	<variable name="LogTxtLocation" value="${LogTxtDir}/${logger}.log"/>
	<variable name="LogTxtLocationFatal" value="${LogTxtDir}/FatalFile.log"/>

	<!--[設定] 寫入目標-->
	<targets>
		<target name="File" xsi:type="File" fileName="${LogTxtLocation}" layout="${Layout}"
				encoding="utf-8" maxArchiveFiles="30" archiveNumbering="Sequence"
				archiveAboveSize="1048576" archiveFileName="${LogTxtDir}/${logger}.log{#######}" />
		<target name="FileFatal" xsi:type="File" fileName="${LogTxtLocationFatal}" layout="${LayoutFatal}"
				encoding="utf-8" maxArchiveFiles="30" archiveNumbering="Sequence"
				archiveAboveSize="1048576" archiveFileName="${LogTxtDir}/FatalFile.log{#######}" />
	</targets>

	<!--[設定] 紀錄規則-->
	<rules>
		<logger name="*" levels="Trace,Debug,Info,Warn" writeTo="File" />
		<logger name="*" levels="Error,Fatal" writeTo="FileFatal" />
	</rules>
	<!--
  See https://github.com/nlog/nlog/wiki/Configuration-file
  for information on customizing logging rules and outputs.
   -->

</nlog>
