title: SQL appender for log4net not working in MVC5 application
body: <p>I can't get log4net to actually log anything to my database. First I added log4net to my project (MVC).
  Then I added this in AssemblyInfo.cs</p>
  
  <pre><code>[assembly: log4net.Config.XmlConfigurator(Watch = true)]
  </code></pre>
  
  <p>In Global.asax.cs Application_Start I end the method with</p>
  
  <pre><code> log4net.GlobalContext.Properties["ApplicationName"] = "MvcApp";
   log.Debug("Application started");
  </code></pre>
  
  <p>I added the following model:</p>
  
  <pre><code> public class Log
  {
      [Key]
      [DatabaseGenerated(System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption.Identity)]
      public int Id { get; set; }
  
      [Required]
      [Display(Name="Date")]
      public DateTime Description { get; set; }
  
      [Required, StringLength(255)]
      [Display(Name="Thread")]
      public string Thread { get; set;}
  
      [Required, StringLength(50)]
      [Display(Name = "Level")]
      public string Level { get; set; }
  
      [Required, StringLength(255)]
      [Display(Name = "Logger")]
      public string Logger { get; set; }
  
      [Required, StringLength(4000)]
      [Display(Name = "Message")]
      public string Message { get; set; }
  
      [Required, StringLength(2000)]
      [Display(Name = "Exception")]
      public string Exception { get; set; }
  }
  </code></pre>
  
  <p>I added this to ApplicationDbContext:</p>
  
  <pre><code> public System.Data.Entity.DbSet&lt;Models.Log&gt; Logs { get; set; }
  </code></pre>
  
  <p>In web.config I added this in the configSections element:</p>
  
  <pre><code> &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /&gt;
  </code></pre>
  
  <p>And then I created this as a child of the configuration element in web.config:</p>
  
  <pre><code>   &lt;log4net debug="true"&gt;
  &lt;appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender"&gt;
    &lt;bufferSize value="100" /&gt;
    &lt;connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
    &lt;connectionString value="Server=windflower.arvixe.com;Initial Catalog=coralys;User Id=coralysdb;Password=CoughUp_23;Application Name=CoralysInternet;" /&gt;
    &lt;commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)" /&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@log_date" /&gt;
      &lt;dbType value="DateTime" /&gt;
      &lt;layout type="log4net.Layout.RawTimeStampLayout" /&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@thread" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="255" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%thread" /&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@log_level" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="50" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%level" /&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@logger" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="255" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%logger" /&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@message" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="4000" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%message" /&gt;
      &lt;/layout&gt;
    &lt;/parameter&gt;
    &lt;parameter&gt;
      &lt;parameterName value="@exception" /&gt;
      &lt;dbType value="String" /&gt;
      &lt;size value="2000" /&gt;
      &lt;layout type="log4net.Layout.ExceptionLayout" /&gt;
    &lt;/parameter&gt;
  &lt;/appender&gt;
  &lt;root&gt;
    &lt;level value="DEBUG"/&gt;
    &lt;appender-ref ref="AdoNetAppender" /&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p></p>
  
  <p>But even with the log.Debug entries nothing is appended. I tried setting the buffer to 5 as a test but no result. I then added a method to flush the buffers as well, no result. And the level is set to maximum (DEBUG).</p>
  
  <p>What else am I missing here?</p>