Reputation: 14039
I am building a small c# web application (written in mvc). I need to log basic info to a database. I've researched and found log4net to be quite extensive and popular.
I'm using mysql as my underline database. I found a few samples of how to log using log4net into mysql database, but non seem to work, and they all seem quite outdated.
Does anyone have a code sample for this?
Thank you very much.
Upvotes: 4
Views: 3130
Reputation: 15303
It seems to me that you can achieve this logging through the AdoNetAppender. It looks like you can configure the connection type (mysql, oracle, sqlserver etc).
The connection type (provider) can be specified by setting the connectionType property
The above was taken from:
http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetAppender.html
I'll try to follow up with an example config for this but I think they do a fair job of explaining how to do this with a sql server database and it seems like you would just need to change the connectionString and connectionType properties.
Upvotes: 4