NLog.Config的配置示例

示例:

  <targets>
    <target xsi:type="File" name="errorFile" fileName="${basedir}/logs/${shortdate}_Error.log"
            layout="${time} ${uppercase:${level}} ${message}" />
    <target xsi:type="File" name="debugFile" fileName="${basedir}/logs/${shortdate}_Debug.log"
            layout="${time} ${uppercase:${level}} ${message}" />
    <target xsi:type="ColoredConsole" name="console"
            layout="${time} ${uppercase:${level}} ${message}" />
  </targets>

  <rules>
    <logger name="*" minlevel="Error" writeTo="errorFile" />
    <logger name="*" minlevel="Debug" writeTo="debugFile" />
    <logger name="*" minlevel="Trace" writeTo="console"/>
  </rules>

 

posted @ 2021-05-21 11:59  wzwyc  阅读(1220)  评论(0编辑  收藏  举报