This is a question I brought up back in 2011 and never ended up pursuing it
far enough.
Scenario:
Currently have Log4Net setup to log all ERROR level events to a database by
using the AdoNetAppender.
Issues:
1) Need combination of Buffering and time based triggering to write events
to the database.
If we set the buffer size to 20 then we do not see anything logged to the
database until the buffer fills up with 20 events which of course exactly
what the buffer is designed to do. Since we want somewhat real-time logging
to the database we end up setting the buffer size to 1 so that every event
is written immediately. However what I would really like to see is a
combination of buffer and timed based trigger events to write my events to
the DB. If this was possible I would set my buffer to 20 events and set a
timed based trigger to 30 seconds. Now my buffer will get written to the DB
any time the timed event happens or 20 events are buffered.
2) Loss of database connectivity causes the AdoNetAppender to no longer
write entries to the database.
Because the AdoNetAppender can cause the thread to hang for a long time if
the database is unavailable we have set the ReconnectOnError to false. This
unfortunately creates the issue I am facing in which if the SQL server is
rebooted or service restarted the application quits talking to the database
until the application is restarted.
I would love to see this feature extended to disable the buffer as it is now
but then on every so many attempts or after a given time period if the
buffer has events reattempt to write the entries to the DB and mark it as
available again.
I am willing to do the work to make the enhancements but would love to see
it make it back into log4net as I am sure others must need something like
the above? Or perhaps I am missing some simple configuration options ?
Thanks
Jim Scott
- AdoNetAppender - Enhancement ? Jim Scott
-