【发布时间】:2020-07-09 20:17:38
【问题描述】:
当我在项目的根目录中创建 nlog.config 文件时,我收到以下消息
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:nlog'.
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:targets'.
This is an invalid xsi:type 'http://www.nlog-project.org/schemas/NLog.xsd:File'.
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:target'.
Could not find schema information for the attribute 'name'.
Could not find schema information for the attribute 'fileName'.
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:rules'.
Could not find schema information for the element 'http://www.nlog-project.org/schemas/NLog.xsd:logger'.
Could not find schema information for the attribute 'minlevel'.
Could not find schema information for the attribute 'writeTo'.
我使用的代码是
<?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">
<!-- the targets to write to -->
<targets>
<!-- write logs to file -->
<target name="allfile" xsi:type="File"
fileName="c:\CsharpTutorials\EmployeeManagement\DemoLogs\nlog-all-${shortdate}.log"/>
</targets>
<!-- rules to map from logger name to target -->
<rules>
<!--All logs, including from Microsoft-->
<logger name="*" minlevel="Trace" writeTo="allfile" />
</rules>
</nlog>
我正在关注一个教程,这是使用的代码。我该如何解决这个问题?
【问题讨论】:
-
代码应该完成什么?帮助我们帮助您。告诉我们一切。如果您表明您已尝试自行解决问题并研究了该问题,但未能解决问题,则您更有可能从社区获得帮助。
-
对不起。该代码应该告诉第三方日志记录提供程序 NLog 将日志信息写入 DemoLogs 文件夹中的 nlog 文件。因此它会创建文件(nlog)和文件夹(DemoLogs)并将错误记录在一个文本文件中。它正在正确记录错误/异常,但这些消息位于错误列表框中。我刚刚开始学习 .net 并没有完全理解它。我浏览过但找不到任何可以修复它的东西。我希望能得到一些指示,以帮助我正确搜索解决方案
标签: xml asp.net-core nlog