NLog不在开发环境中编写

时间:2019-02-18 13:08:44

标签: .net-core nlog

我一直试图在Asp.Net Core Web Api应用程序中实现NLog。这是我的nlog.config:

<?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"
      internalLogLevel="Trace"
      internalLogFile=".\logs\internal-nlog.txt">

  <extensions>
    <add assembly="NLog.Web.AspNetCore"/>
  </extensions>

  <targets>
    <target xsi:type="File" name="allfile" fileName="${basedir}\logs\nlog-all-${shortdate}.log"
            layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}" />
  </targets>

  <rules>
    <logger name="*" minlevel="Trace" writeTo="allfile" />
  </rules>
</nlog>

该代码对本地主机运行良好,它可以在本地主机上创建和写入日志,但是,尽管可以在开发环境中创建日志文件,但是不向其写入任何内容,但是它在开发环境中不起作用。

我已经通过在开发环境中的同一文件夹中创建文本文件来测试权限。

任何想法在这里可能是什么问题?

0 个答案:

没有答案
相关问题