log4net.Config.XmlConfigurator.Configure() taking too much time
Recently, I came across a strange issue with my log4net configuration. When I run my application it’s taking almost 15 to 30 seconds at following statement and it leads to the heavy performance issue.
I started investigating what went wrong with this statement as this is working fine previously. Then I realized that recently I changed the database and I didn’t modify a Connectionstring element in my appender as I am dynamically assigning my connection string via source code.
When I call this statement, log4net trying to connect this database which is not there and it keeps trying until connection timeout expires (by default 30 sec.).
To resolve this you need to change the working connection string or if you don’t want to change every time include a connection timeout = 2 in your connection string such that log4net don’t wait for a long time.