title: Log4net - multiple appenders
body: <p>I currently have two appenders, one is for logging in a file and the other is for logging in a database. The ado net appender is not working, it's not logging anything in the table. The rolling file appender however, works just fine. It logs in the file. If I remove the rolling file appender, the logging in the database works just fine. </p>
  
  <p>Here's part of my app.config file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
  &lt;configSections&gt;
  &lt;sectionGroup name="common"&gt;
    &lt;section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" /&gt;
  &lt;/sectionGroup&gt;
  &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /&gt;
      &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
   &lt;/configSections&gt;
  &lt;connectionStrings&gt;
      &lt;add name="Log4NetDBConnection" connectionString="Data Source=localhost;Initial Catalog=DataProcessing;UID=dpp-user;PWD=dpp-user" providerName="System.Data.SqlClient" /&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code> &lt;common&gt;
  &lt;logging&gt;
    &lt;factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net1211"&gt;
      &lt;arg key="configType" value="INLINE" /&gt;
      &lt;/factoryAdapter&gt;
     &lt;/logging&gt;
     &lt;/common&gt;
    &lt;log4net configSource="App.log4net.config" /&gt;
      &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name="Common.Logging.Core" publicKeyToken="af08829b84f0328e" culture="neutral" /&gt;
      &lt;bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" /&gt;
    &lt;/dependentAssembly&gt;
    &lt;dependentAssembly&gt;
      &lt;assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" /&gt;
      &lt;bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" /&gt;
    &lt;/dependentAssembly&gt;
  &lt;/assemblyBinding&gt;
  </code></pre>
  
  <p>
    </p>
  
  <p>And here is my App.Log4net.config file:</p>
  
  <pre><code>&lt;log4net&gt;
  &lt;!-- Needed for default logger behavior to the log table--&gt;
  &lt;root&gt;
  &lt;level value="ERROR" /&gt;
  &lt;level value="WARN" /&gt;
  &lt;appender-ref ref="AdoNetAppender" /&gt;
  &lt;/root&gt;
  &lt;appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender"&gt;
  &lt;bufferSize value="1" /&gt;
  &lt;connectionType value="System.Data.SqlClient.SqlConnection,System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
  &lt;connectionStringName value="DPPLog4NetDBConnection" /&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;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;!-- &lt;root&gt;
  &lt;level value="DEBUG" /&gt;
  &lt;appender-ref ref="RollingFileAppender" /&gt;
  &lt;/root&gt;
  &lt;appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
  &lt;level value="ALL" /&gt;
  &lt;file value="c:/logs/WorkflowEngineApp.log" /&gt;
  &lt;appendToFile value="true" /&gt;
  &lt;rollingStyle value="Size" /&gt;
  &lt;maxSizeRollBackups value="10" /&gt;
  &lt;maximumFileSize value="10MB" /&gt;
  &lt;staticLogFileName value="true" /&gt;
  &lt;layout type="log4net.Layout.PatternLayout"&gt;
    &lt;conversionPattern value="%date [%thread] %level %logger - 
  %message%newline%exception" /&gt;
  &lt;/layout&gt;
  &lt;/appender&gt; --&gt;
  
  &lt;/log4net&gt;
  </code></pre>
  
  <p>As you can see, I have the rolling file appender commented because otherwise it only logs in a file. What am I doing wrong? Can I use these two appenders together? </p>