【发布时间】:2018-01-17 06:26:33
【问题描述】:
我是 Nlog 新手,将 Nlog 配置放在配置部分下方的 app.config 文件中,并在配置部分中定义一个部分名称,但我仍然收到此错误“配置系统无法初始化”。以下是我的 app.config 文件的内容。
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</sectionGroup>
</configSections>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="console" xsi:type="Console"
layout="${date:format=HH\:mm\:ss} ${level:uppercase=true} ${logger} 
${message} ${exception:format=message,type,stacktrace}"
/>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="console" />
</rules>
</nlog>
</configuration>
我将 nlog 移到 sectionGroup 之外,因为它不是 applicatinSettings 标记的成员。对不起我的错。
【问题讨论】:
标签: nlog