如何实现示例 log4net 存储库

发布于 2024-08-14 23:10:36 字数 384 浏览 4 评论 0原文

如何为我的 XML 文件实现自定义 LOG4NET 解析器。我的 XML 文件包含:
(1)appender元素上的额外属性
(2) 对一些需要在运行时设置的appender的元素进行自定义替换。

例如:


${MyValueForThisPropertyFromDB}

我读到我应该使用 LoggerRepositorySkeleton 实现一个自定义存储库,但不确定如何将整个事情放在一起。有什么建议吗?

How do I implement a custom LOG4NET parser for my XML file. My XML file contains:
(1) extra attributes on the appender element
(2) custom replacements on the elements of some of the appenders that need to be set at runtime.

For example:

<appender name=... type=... mode="something">
<some-property-of-appender>${MyValueForThisPropertyFromDB}</some-property-of-appender>
</appender>

I have read that I am supposed to implement a Custom Repository probably using the LoggerRepositorySkeleton but not sure how to put this whole thing together. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情何以堪。 2024-08-21 23:10:36

由于您尝试从数据库初始化大部分 log4net 配置,最简单的方法是 从代码配置log4net。然后,您将完全控制您使用的参数值以及它们的来源。

Since you are trying to initialize most of the log4net configuration from database the easiest way would be to configure log4net from code. Then you will have full control over what parameter values you use and where they come from.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文