Reputation: 463
Configuration file (except variables) contains data:
<?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"
throwExceptions="false">
<extensions>
<add assembly="NLog.Extended" />
</extensions>
<targets async="True">
<target name="TraceLogger"
type="File"
fileName="${TraceFullPath}"
archiveFileName="${TraceArchiveFullPath}"
maxArchiveFiles="100"
archiveNumbering="Sequence"
archiveEvery="None"
layout="${message}" />
</targets>
<rules>
<logger name="*"
minLevel="Trace"
writeTo="TraceLogger"
enabled="True" />
</rules>
</nlog>
Test execution code is:
var configuration = new XmlLoggingConfiguration(configurationPath);
var factory = new LogFactory(configuration);
var logger = factory.GetCurrentClassLogger();
logger.Trace("Message");
Debugger shows next properties values for:
configuration.base.LogginRules: Count = 0
configuration.base.AllTargets: Count = 0
logger.Is...Enabled = false (for all levels)
Any ideas what I'm doing wrong?
Upvotes: 2
Views: 603
Reputation: 463
Problem was simple: case-sensitive typo in variables and target value
I am sorry that took your time
Upvotes: 2