Log4net appender for mysql in c # application

I am creating a small C # web application (written in mvc). I need to write basic information to a database. I researched and found log4net quite extensive and popular.

I use mysql as my base base. I found some examples of how to log log4net to the mysql database, but it doesn’t work, and they all look pretty dated.

Does anyone have some sample code for this?

Thank you very much.

+4
source share
1 answer

It seems to me that you can complete this registration through 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 Above was taken from:
http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetAppender.html

I will try to run a configuration example for this, but I think they rightly explain how to do this with the sql server database, and it looks like you just need to change the connectionString and connectionType .

+4
source

Source: https://habr.com/ru/post/1368892/


All Articles