【发布时间】:2011-03-06 20:33:29
【问题描述】:
我们在 Vb.Net 中有几个应用程序使用内置的日志系统 (My.Log) 来写入日志信息。到目前为止,这个系统在执行之前是由 application.config 文件配置的,但现在我们想让用户选择一些选项。
有没有一种不需要解析 XML 文件并对其进行处理的方法?有没有像 My.Settings 这样的东西可以完成肮脏的工作?
提前致谢。
一个示例是能够将 DefaultSwitch 值从 Verbose 修改为 Warning 或更改 FileLog 的属性,例如 maxFiles 属性:
<switches>
<add name="DefaultSwitch" value="Verbose" />
</switches>
<sharedListeners>
<add name="FileLog" type="Sipro.Utils.ExtendedLogTraceListener, Sipro.Utils, Version=1.0.6.0, Culture=neutral, PublicKeyToken=null"
autoflush="True"
delimiter=" - "
diskspaceexhaustedbehavior="DiscardMessages"
includehostname="False"
logfilecreationschedule="Daily"
maxfiles="31"
fullinformation="True"
includeDate="True"
includeTicks="True"/>
【问题讨论】:
标签: .net vb.net logging settings