[ https://issues.apache.org/jira/browse/LOG4NET-202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682055#action_12682055 ]
Ron Grabowski commented on LOG4NET-202: --------------------------------------- Have you tried using SqlDbType.Text and/or a size of -1? http://stackoverflow.com/questions/596257/what-sqldbtype-maps-to-varcharmax > AdoNetAppenderParameter.Size Property is not optional > ----------------------------------------------------- > > Key: LOG4NET-202 > URL: https://issues.apache.org/jira/browse/LOG4NET-202 > Project: Log4net > Issue Type: Bug > Components: Documentation > Affects Versions: 1.2.10 > Environment: Windows Server 2008, .NET 3.5 SP1, SQL Server 2008 > Reporter: Richard Dingwall > Original Estimate: 0.5h > Remaining Estimate: 0.5h > > The AdoNetAppenderParameter.Size page > (http://logging.apache.org/log4net/release/sdk/log4net.Appender.AdoNetAppenderParameter.Size.html) > says "This property is optional. If not specified the ADO.NET provider will > attempt to infer the size from the value." > However, I just got the following exception in the log4net internal debug > trace, with the following parameter (maps to a VARCHAR(MAX)): > <parameter> > <parameterName value="@exception" /> > <dbType value="String" /> > <layout type="log4net.Layout.ExceptionLayout" /> > </parameter> > log4net:ERROR [AdoNetAppender] Could not prepare database command [INSERT > INTO ....] > System.InvalidOperationException: SqlCommand.Prepare method requires all > variable length parameters to have an explicitly set non-zero Size. > at System.Data.SqlClient.SqlParameter.Prepare(SqlCommand cmd) > at System.Data.SqlClient.SqlCommand.Prepare() > at log4net.Appender.AdoNetAppender.InitializeDatabaseCommand() > This would suggest the Size parameter cannot be null. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.