Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-202

AdoNetAppenderParameter.Size Property is not optional

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.10, 1.2.11
    • 1.2.12
    • Documentation
    • None
    • Windows Server 2008, .NET 3.5 SP1, SQL Server 2008

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            rdingwall Richard Dingwall
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.5h
                0.5h
                Remaining:
                Remaining Estimate - 0.5h
                0.5h
                Logged:
                Time Spent - Not Specified
                Not Specified