title: Log4Net with AdoNetAppender - nothing happens
body: <h2>Description</h2>
  
  <p>I have a config file as a resource in my assembly and want to change the ConnectionString programmatically in my application. </p>
  
  <p>I load the configuration using <code>log4net.Config.XmlConfigurator.Configure</code>. </p>
  
  <p>I have some breakpoints and see that the configuration is loaded successfuly and the connectionstring is <code>Data Source=localhost\SQLExpress;Initial Catalog=Log;Integrated Security=SSPI;</code> (local SQLExpress).</p>
  
  <h2>Problem</h2>
  
  <p>Nothing happens, no exception and no log entry. Any ideas.</p>
  
  <pre class="lang-cs prettyprint-override"><code>using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("MyNamespace.Properties.log4net.config"))
  { 
      // stream is NOT null
      log4net.Config.XmlConfigurator.Configure(stream);
  }
  
  Hierarchy hier = LogManager.GetRepository() as Hierarchy;
  
  if (hier != null)
  {
      //get ADONetAppender
      var adoAppender = (AdoNetAppender)hier.GetAppenders().Where(appender =&gt; appender.Name.Equals("AdoNetAppender", StringComparison.InvariantCultureIgnoreCase)).FirstOrDefault();
  
      if (adoAppender != null)
      {
          // update connectionstring
          adoAppender.ConnectionString = configuration.GetConnectionString(ConnectionStringNames.Log).ConnectionString;
          //refresh settings of appender
          adoAppender.ActivateOptions(); 
      }
  }
  
  ILog logger = LogManager.GetLogger("MyProject"); 
  logger.Warn("Test");
  </code></pre>
  
  <p><strong>content of the <em>log4net.config</em> file</strong></p>
  
  <pre class="lang-xml 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="1" /&gt;
        &lt;connectionType value="System.Data.SqlClient.SqlConnection, System.Data,
    Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;
        &lt;connectionString value="[we will set this automatically at runtime]" /&gt;
        &lt;commandText value="INSERT INTO Log ([Date],[Level],[Logger],[Message],[Exception])
    VALUES (@log_date, @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="@log_level" /&gt;
          &lt;dbType value="String" /&gt;
          &lt;size value="50" /&gt;
          &lt;layout type="log4net.Layout.PatternLayout"&gt;
            &lt;conversionPattern value="%p" /&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="%c" /&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="%m" /&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="ALL" /&gt;
        &lt;appender-ref ref="AdoNetAppender" /&gt;
      &lt;/root&gt;
    &lt;/log4net&gt;
  &lt;/configuration&gt;
  </code></pre>