I am modifying the
buffer size and the connection string of ADONetAppenders programmatically and I
am getting a SqlConnection leak. The number of open connections to SQL
Server grows to the max connection pool size when I do this
repeatedly.
The leak occurs when
I call ActivateOptions on the ADONetAppender after I set its BufferSize and
ConnectionString. The documentation says that you need to call
ActivateOptions after you modify the appenders configuration. The
ActivateOptions method creates a new connection and overwrites the
ADONetAppenders connect member m_dbConnection with the new instance.
The leak occurs because the the old connection is not
closed.
Here is basically what I am
doing:
...
((log4net.Appender.BufferingAppenderSkeleton)logAppender).BufferSize =
size;
((log4net.Appender.ADONetAppender)logAppender).ConnectionString =
ADOConnectionString;
((log4net.Appender.ADONetAppender)logAppender).ActivateOptions();
I am doing something
wrong or is this a bug?
thanks,
Nick
