如何在 log4net 中配置基于 bufferred 和超时的附加程序?

发布于 2024-08-11 08:16:19 字数 259 浏览 4 评论 0原文

我想在 log4net 中配置一个 Forwarding-Appender,它执行以下操作:

  1. 它最多缓冲 N 条消息。当达到 N 时,执行其触发器并转发其缓冲区。不损耗。
  2. 如果达到定义的超时,它将转发其缓冲的消息。因此,当达到超时时触发器也会执行。
  3. 当宿主程序终止/关闭时,它转发其缓冲的消息。

所以我需要的是一个复合触发器:基于计数、超时和程序终止。

如果有的话,我该如何配置这样的附加程序?

I want to configure a Forwarding-Appender in log4net, that does the following:

  1. It buffers up to N messages. When N is reached, its trigger is executed and it forwards its buffer. Not lossy.
  2. It forwards its buffered messages if a defined timeout is reached. So the trigger is executed also when a timeout is reached.
  3. It forwards its buffered messages when the hosting program terminates/closed.

So what I need is a composite trigger: based on count, timeout, and program termination.

How can I configure such appender, if at all?

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

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

发布评论

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

评论(1

画骨成沙 2024-08-18 08:16:19

我认为默认发行版中没有任何可用的附加程序可以执行此操作。你必须自己动手,但这并不难。

I don't think there are any appenders available in the default distribution that do this. You'll have to roll you own, but it's not too hard to do.

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