I'd like to extend log4net to accept custom log objects as parameter. For example:
public class MyLogObject
{
public string PropA;
public int PropB;
}
private MyLogObject entry = new MyLogObject() {PropA = "FooBar", PropB = 1};
Log.Debug(entry);
... this should work similar to exceptions.
In the second step the custom log objects should be written into a database by a custom database appender. The custom database appender will be is similar to the ADONetAppender but with a few modifications like an internal buffered queue of log entries.
Does anyone know if this works with log4net and if there are any examples with may help me how to do it?
The properties of my log object and the database fields are fixed, so there is no need for making them configurable.
Update My idea was to configure log4net to use my custom "MyAppender" together with the custom renderer "MyRenderer". The renderer will return a simple SQL-insert-statement with is written to the database by the appender. Maybe there is a better way to do this.