[ https://issues.apache.org/jira/browse/LOG4NET-489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15003914#comment-15003914 ]
Dominik Psenner commented on LOG4NET-489: ----------------------------------------- It will have to do with this change, but I do not yet understand why this is the case. Apologies for the inconvenience, I'm on it. Revision: 1711736 Author: dpsenner Date: 01 November 2015 12:50:44 Message: LOG4NET-461: refactored the AdoNetAppender The AdoNetAppender suffered several issues. One was that a database command was created and stored for the appenders lifetime. This caused trouble with some database servers because those cleaned up cached prepared statements from time to time and thus caused the appender to fail without the capability to recover. I solved this problem by creating a database command whenever the buffer is sent, well knowing that this costs a little more performance but is much more stable. At this point I further took the chance to cleanup the source by replacing all references to private member attributes with their public property mapping. Further I added and fixed some of the documentation. This overall cleanup is not yet complete, meaning that there is still a connection that is being kept alive while it would be wiser to rely on proper connection pooling and just open/close the database connection when sending the buffer. I will raise this topic on the dev list. ---- Modified : /logging/log4net/trunk/src/Appender/AdoNetAppender.cs > AdoNetAppender fails after upgrade to 2.0.4 > ------------------------------------------- > > Key: LOG4NET-489 > URL: https://issues.apache.org/jira/browse/LOG4NET-489 > Project: Log4net > Issue Type: Bug > Components: Appenders > Affects Versions: 1.2.14 > Environment: Windows > Reporter: Philip Lee > > with 1.2.13 everything is working fine. > Update to 1.2.14 (2.0.4 on Nuget), logging fails. > I would have attached screenshots, but can't work out how. > For example > <connectionType > value="System.Data.SqlClient.SqlConnection, System.Data, > Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> > <connectionStringName value="LabelPrint" /> > <commandText > value="INSERT INTO dbo.Logging > ([LogDate],[Level],[Operation],[OperationInfo],[User],[Label],[Application],[CorrelationId],[Method],[Line],[Logger],[Message],[Exception]) > > VALUES (@log_date, @log_level, @operation, @operationInfo, > @user, @label, @application, @correlationId, @pgm_method, @pgm_line, @logger, > @message, @exception)" /> > <parameter> > <parameterName value="@log_date" /> > <dbType value="DateTime" /> > <layout type="log4net.Layout.RawUtcTimeStampLayout" /> > </parameter> > ... etc > This now causes the error > 'Exception while writing to database System.IndexOutOfRangeException: An > SqlParameter with ParamerName '@log_date' is not contained by this > SqlParameterCollection .... -- This message was sent by Atlassian JIRA (v6.3.4#6332)