如何在 log4net 中配置基于 bufferred 和超时的附加程序?
我想在 log4net 中配置一个 Forwarding-Appender,它执行以下操作:
- 它最多缓冲 N 条消息。当达到 N 时,执行其触发器并转发其缓冲区。不损耗。
- 如果达到定义的超时,它将转发其缓冲的消息。因此,当达到超时时触发器也会执行。
- 当宿主程序终止/关闭时,它转发其缓冲的消息。
所以我需要的是一个复合触发器:基于计数、超时和程序终止。
如果有的话,我该如何配置这样的附加程序?
I want to configure a Forwarding-Appender in log4net, that does the following:
- It buffers up to N messages. When N is reached, its trigger is executed and it forwards its buffer. Not lossy.
- It forwards its buffered messages if a defined timeout is reached. So the trigger is executed also when a timeout is reached.
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为默认发行版中没有任何可用的附加程序可以执行此操作。你必须自己动手,但这并不难。
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.