title: Log4Net not writing to SQL Table
body: <p>Can someone off a 2nd set of eyes? I am clearly missing something. </p>
  
  <p>I'm using Log4Net in a Web API app. Whenever I invoke a Log.Error() it executes, but nothing actually gets written to my dbo.Log table. I am running a local database. When I replaced the configuration with one that wrote to a file, the code worked perfectly. </p>
  
  <p>Here is what my configuration and code looks like. </p>
  
  <p>The Log4Net.config file contains the following: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /&gt;
    &lt;/configSections&gt;
  
    &lt;log4net&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="Data Source=MUD-DAD\SQLEXPRESS;Initial Catalog=FitAchiever;Persist Security Info=True;User ID=sa;Password=asdadf334"/&gt;
        &lt;commandText value="INSERT INTO dbo.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;
    &lt;/log4net&gt;
  &lt;/configuration&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The Global.asax.cs file contains the following, note the call to the Log4Net.Config() method which specifies which config to use. </p>
  
  <pre><code>    public class WebApiApplication : System.Web.HttpApplication
  {
      private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(WebApiApplication));
      protected void Application_Start()
      {
  
          log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(Server.MapPath("Log4Net.config")));
  
          AreaRegistration.RegisterAllAreas();
          GlobalConfiguration.Configure(WebApiConfig.Register);
          FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
          RouteConfig.RegisterRoutes(RouteTable.Routes);
          BundleConfig.RegisterBundles(BundleTable.Bundles);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The initialization of the logger in my Controller is: </p>
  
  <pre><code>   public class FitDashboardController : ApiController
  {
      private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  
      IFitDashboardService fitDashboardService = new FitDashboardService();
  </code></pre>
  
  <p>...</p>
  
  <p>And the call is: </p>
  
  <pre><code>            catch (System.Exception ex)
          {
              log.Error("Error:" + MethodBase.GetCurrentMethod().Name + " :: " + ex.Message);
  
          }
  </code></pre>
  
  <p>Again, the code works when writing to a file, but not the database. Any ideas? </p>