我在一个单独的地方有一个类库和配置文件我想使用它所以我执行以下操作
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(configurationFile , true);
LogManager.ReconfigExistingLoggers();
NLog 的配置是远程 app.config 的一部分,看起来像
<configuration>
<!-- ... -->
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<!--
Log in a separate thread, possibly queueing up to
5000 messages. When the queue overflows, discard any
extra messages
-->
<target name="file" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard"
layout="${machinename} - ${level} - ${longdate} - ${callsite} - ${threadid} - ${message} ${exception:format=tostring}">
<target xsi:type="File" fileName="C:\logs/${level}.txt" />
</target>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="file" />
</rules>
</nlog>
</configuration>
配置对象LogManager.Configuration
总是有默认值,知道如何解决这个问题。