English 中文(简体)
how to configure a bufferred and timeout based appender in log4net?
原标题:

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?

最佳回答

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.

问题回答

暂无回答




相关问题
Log4Net and extra fields

Is it possible to insert extra fields into the database and use them in log4net? I have a UserId I would like to have in an extra field in the log-table. I have added the field in the log4net.config:...

log4net with .NET 4.0

I ve thrown together some code to tinker with the new .Net 4.0/VS 2010 pieces, but I can t seem to find a build of my logging framework of choice (log4net) for 4.0, and I m getting reference errors ...

Best logging approach for composite app?

I am creating a Composite WPF (Prism) app with several different projects (Shell, modules, and so on). I am getting ready to implement logging, using Log4Net. It seems there are two ways to set up the ...

log4net log files disappear when service restarted

We are using log4net to create our logfiles from Windows services, and we are using the RollingFileAppender rolling based on date. The version of log4net we are using is 1.2.9. Now for the issue. ...

How do I use a date pattern in a header/footer?

Here s my appender configuration from my app.config. This just prints out the literal string instead of translating it to the date (i.e., it literally prints "[START: %date{MM/dd/yy HH:mm} ]"). <...

热门标签