gpt4 book ai didi

.net - 有没有一种方法可以将NLog.config信息放入我的app.config文件中?

转载 作者:行者123 更新时间:2023-12-01 18:45:22 52 4
gpt4 key购买 nike

有没有一种方法可以将NLog.config信息放入我的app.config文件中?这样,我可以拥有一个配置文件,而不是两个。它可能看起来像这样:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nlog" type="..." />
</configSections>
<nlog>
<targets>...</targets>
<rules>...</rules>
</nlog>
</configuration>

请让我知道这是否重复。

最佳答案

当然,您可以将配置放入app.config文件中。

您只需要使用NLog.Config.ConfigSectionHandler,因此您需要编写

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
</configSections>
<nlog>
<targets>...</targets>
<rules>...</rules>
</nlog>
</configuration>

NLog documentation部分中 Configuration file format中所述。

关于.net - 有没有一种方法可以将NLog.config信息放入我的app.config文件中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26765934/

52 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com