Search code examples
connection-stringlog4net-configurationadonetappender

log4net connection type invalid in AdoNetAppender


I have implemented log4net ver 1.2.13.0 without major problems.(.Net ver 4.51 C#4) I add an AdoNetAppender following documentation.

But here is my piece of code causing some troubles :

     <appender name           ="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
      <bufferSize value      ="1" />
      <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>  

I have a warning message not blocking my app but annoying and very disturbing :

The 'value' attribute is invalid - The value 'System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is invalid according to its datatype 'connectionTypeTypes' - The Enumeration constraint failed.

Where is the problem and the solution to get rid off this message ?

Many thanks in advance.


Solution

  • The log4net schema file (http://csharptest.net/downloads/schema/log4net.xsd) has this definition:

    <xs:enumeration value="System.Data.SqlClient.SqlConnection, System.Data" />
    

    If you change your setting to match this value, the warning will disappear.