title: Can't load Log4Net configuration
body: <p>I have a brand new console application in vb.net. I want to use log4net so I did the following steps and it works. Great. Yahoo.</p>
  <p>But I have to place Log4Net.config in bin/debug together with Log4Net.dll and Log4Net.xml. I have tried many things but no joy. Or I haven't got to a right combination. How can I move Log4Net.config to app root?</p>
  <p>Installed Log4Net from NuGet.</p>
  <p>I added</p>
  <pre><code>&lt;Assembly: XmlConfigurator(ConfigFile:=&quot;Log4Net.config&quot;, Watch:=True)&gt; 
  </code></pre>
  <p>in AssemblyInfo.vb.</p>
  <p>This is how I am calling it:</p>
  <pre class="lang-vb prettyprint-override"><code>Public Class Class1
  
  'Save log4net log into SQL Server
  Private Shared ReadOnly DBlog As ILog = LogManager.GetLogger(&quot;TestLog4Net&quot;)
  
  Public Shared Sub Main(ByVal args() As String)
  
      DBlog.Error(&quot;Log4Net testing v1&quot;)
  
  End Sub
  
  End Class
  </code></pre>
  <p>My Log4Net.Config:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;section name=&quot;log4net&quot; type=&quot;log4net.Config.Log4NetConfigurationSectionHandler, log4net&quot; /&gt;
    &lt;/configSections&gt;
    &lt;log4net&gt;
  
      &lt;appender name=&quot;AdoNetAppender&quot; type=&quot;log4net.Appender.AdoNetAppender&quot;&gt;
        &lt;bufferSize value=&quot;1&quot; /&gt;
        &lt;connectionType value=&quot;System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&quot; /&gt;
  
        &lt;connectionString value=&quot;xxxxx&quot; /&gt;
        &lt;commandText value=&quot;xxxxx&quot; /&gt;
        &lt;parameter&gt;
          &lt;parameterName value=&quot;@log_date&quot; /&gt;
          &lt;dbType value=&quot;DateTime&quot; /&gt;
          &lt;layout type=&quot;log4net.Layout.RawTimeStampLayout&quot; /&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value=&quot;@thread&quot; /&gt;
          &lt;dbType value=&quot;String&quot; /&gt;
          &lt;size value=&quot;255&quot; /&gt;
          &lt;layout type=&quot;log4net.Layout.PatternLayout&quot;&gt;
            &lt;conversionPattern value=&quot;%thread&quot; /&gt;
          &lt;/layout&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value=&quot;@log_level&quot; /&gt;
          &lt;dbType value=&quot;String&quot; /&gt;
          &lt;size value=&quot;50&quot; /&gt;
          &lt;layout type=&quot;log4net.Layout.PatternLayout&quot;&gt;
            &lt;conversionPattern value=&quot;%level&quot; /&gt;
          &lt;/layout&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value=&quot;@logger&quot; /&gt;
          &lt;dbType value=&quot;String&quot; /&gt;
          &lt;size value=&quot;255&quot; /&gt;
          &lt;layout type=&quot;log4net.Layout.PatternLayout&quot;&gt;
            &lt;conversionPattern value=&quot;%logger&quot; /&gt;
          &lt;/layout&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value=&quot;@message&quot; /&gt;
          &lt;dbType value=&quot;String&quot; /&gt;
          &lt;size value=&quot;4000&quot; /&gt;
          &lt;layout type=&quot;log4net.Layout.PatternLayout&quot;&gt;
            &lt;conversionPattern value=&quot;%message&quot; /&gt;
          &lt;/layout&gt;
        &lt;/parameter&gt;
        &lt;parameter&gt;
          &lt;parameterName value=&quot;@exception&quot; /&gt;
          &lt;dbType value=&quot;String&quot; /&gt;
          &lt;size value=&quot;2000&quot; /&gt;
          &lt;layout type=&quot;log4net.Layout.ExceptionLayout&quot; /&gt;
        &lt;/parameter&gt;
      &lt;/appender&gt;
  
      &lt;logger name=&quot;TestLog4Net&quot;&gt;
        &lt;level value=&quot;ALL&quot; /&gt;
        &lt;appender-ref ref=&quot;AdoNetAppender&quot; /&gt;
      &lt;/logger&gt;
  
    &lt;/log4net&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p><strong>I have tried</strong></p>
  <p>to set the following line before I say <code>DBlog.Error(&quot;xx&quot;)</code></p>
  <pre class="lang-vb prettyprint-override"><code>log4net.Config.XmlConfigurator.Configure()
  </code></pre>
  <p>to set this in app.config.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;log4net configSource=&quot;Log4Net.config&quot; /&gt;
  </code></pre>
  <p>to move the whole Log4Net.config to app.config. That didn't work.</p>
  <p>to set this as someone suggested on one post. That didn't work either.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;appSettings&gt;
      &lt;add key=&quot;log4net.Config&quot; value=&quot;log4net.config&quot;/&gt;
      &lt;add key=&quot;log4net.Config.Watch&quot; value=&quot;True&quot;/&gt;
  &lt;/appSettings&gt;
  </code></pre>
  <p>to declare this instead of the <code>GetLogger(&quot;name&quot;)</code> that I am using. No joy either.</p>
  <pre class="lang-vb prettyprint-override"><code>Private Shared ReadOnly log As ILog = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
  </code></pre>