【发布时间】:2013-11-26 23:04:18
【问题描述】:
我有一个 winForm 应用程序。我正在使用 NLog 进行日志记录。我的配置文件如下。我可以在运行时定义此配置文件中的任何参数吗?例如对于archiveAboveSize="4000",我可以在winform中有一个numericupdown,它可以从用户那里输入这个值(这样4000可以是3000或5000),然后在配置文件中相应地设置这个值?
<?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">
<targets>
<target xsi:type="File"
name="file"
layout="${longdate}|${level:uppercase=true}|${logger}|${message}"
archiveAboveSize="4000"
maxArchiveFiles="1"
archiveFileName="${basedir}/log_archived.txt"
fileName="log.txt" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="file" />
</rules>
</nlog>
【问题讨论】: