Is any way to override SendBuffer
method in AdoNetAppender
to bulk insert logs in database?
in below this link in SendBuffer
method log4net write logs in database by iteration over loggingevent and insert each of them in separated query, I wanna insert all logs in a query, i think this approach increase performance.
You can make a class like:
public class MyAdoNetAppender : AdoNetAppender
{
override protected void SendBuffer(IDbTransaction dbTran, LoggingEvent[] events)
{
(... implementation goes here)
}
}
You can use the class in config like (MyDll is your dll name, and make sure you have the namespace correct):
<appender name="A1" type="MyAdoNetAppender,MyDll">