添加安装包:

Install-Package NLog.Web.AspNetCore
<?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"
      autoReload="true">
  <targets>
    <target name="file" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard">
      <target xsi:type="File"
              fileName="${basedir}/Logs/${shortdate}.log"
              layout="${longdate} ${level:uppercase=true} ${event-context:item=Action} ${message} ${event-context:item=Amount} ${stacktrace}"
              keepFileOpen="false"
              archiveFileName="${basedir}/Logs/${shortdate}.{##}.log"
              archiveAboveSize="1048576"
              encoding="UTF-8" />
    </target>
  </targets>
  <rules>
    <!--Trace->Debug->Info->Warn->Error->Fatal-->
    <logger name="*" minlevel="Trace" writeTo="file" />
  </rules>
</nlog>
NLog.config

相关文章:

  • 2021-08-30
  • 2019-11-17
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
  • 2021-08-10
猜你喜欢
  • 2019-01-22
  • 2022-01-26
  • 2022-12-23
  • 2021-07-12
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案