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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.