<?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">
  <!-- enable asp.net core layout renderers -->
  <!-- 定义变量var1-->
  <variable name="var1" value="${basedir}/logs"/>
  <targets>
    <target name="file" xsi:type="File" archiveAboveSize="31457280" fileName="${var1}/${date:format=yyyy}-${date:format=MM}/${shortdate}.log" layout="[${longdate}][${level:uppercase=true}][${logger}]${message}${exception}" encoding="utf-8"/>
    <target name="mylog" xsi:type="File" archiveAboveSize="31457280" fileName="${var1}/${date:format=yyyy}-${date:format=MM}/${shortdate}-error.log" layout="[${longdate}][${level:uppercase=true}][${logger}]${message}${exception}" encoding="utf-8"/>
    <target name="makecard" xsi:type="File" archiveAboveSize="31457280" fileName="${var1}/makecard/${date:format=yyyy}-${date:format=MM}/${shortdate}.log" layout="[${longdate}][${level:uppercase=true}][${logger}]${message}${exception}" encoding="utf-8"/>
    <target name="quartz" xsi:type="File" archiveAboveSize="31457280" fileName="${var1}/quartz/${date:format=yyyy}-${date:format=MM}/${shortdate}.log" layout="[${longdate}][${level:uppercase=true}][${logger}]${message}${exception}" encoding="utf-8"/>
    <target name="sql" xsi:type="File" archiveAboveSize="31457280" fileName="${var1}/${date:format=yyyy}-${date:format=MM}/${shortdate}-sql.log" layout="[${longdate}][${level:uppercase=true}][${logger}]${message}${exception}" encoding="utf-8"/>
  </targets>
  <rules>
    <!-- 对dotnet系统自动产生的日志不予记录-->
    <logger name="Microsoft.*" minlevel="debug" writeTo="" final="true" enabled="true" />
    <logger name="*" minlevel="Error" maxlevel="Fatal" writeTo="mylog" />
    <logger name="*" minlevel="Debug" maxlevel="Warn" writeTo="file" />
    <logger name="makecard" minlevel="Debug" writeTo="makecard" />
    <logger name="quartz" minlevel="Debug" writeTo="quartz" />
    <logger name="sql" minlevel="Debug" writeTo="sql" />
  </rules>
</nlog>
