log4net to SQLServer : what happens if database is unavailable?

前端 未结 3 1573
挽巷
挽巷 2020-12-10 06:13

I have a log4net ado appender writing to a SQL Server database. I like it, I think it\'s neat. Before I send it into production, I want to know what the behaviour will be if

3条回答
  •  一个人的身影
    2020-12-10 06:58

    If in .Net 4.5.1 or later you will also have to set ConnectRetryCount=0; in your connection string.

    Appender Configuration:

    
    
    

    If you do Async logging like Log4Net.Async then Connect Timeout may be left at default 15 seconds.

    Details

    .Net 4.5.1 adds ADO.NET connection resiliency which tells Log4Net the connection is still open even though it isn't and attempts to reconnect using ConnectRetryCount. However since we want to let Log4Net do the reconnecting and ConnectRetryCount has a max of 255 we should set ConnectRetryCount to 0. Source: https://issues.apache.org/jira/browse/LOG4NET-442 https://blogs.msdn.microsoft.com/dotnet/2013/06/26/announcing-the-net-framework-4-5-1-preview/

提交回复
热议问题