title: log4net:ERROR Exception while reading ConfigurationSettings. Check your .config file is well formed XML
body: <p>I am trying to implement log4net into my console application but I get a bunch of errors like</p>
  <blockquote>
  <p>log4net: Error exception while reading configurationSettings.</p>
  </blockquote>
  <p>I googled and after checking many questions asked here at stackoverflow I posted this one. I know there is nothing wrong with my app.config file.</p>
  <p>Here is my App.config file</p>
  <pre><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;ConsoleAppender&quot; type=&quot;log4net.Appender.ConsoleAppender&quot;&gt;
        &lt;layout type=&quot;log4net.Layout.PatternLayout&quot;&gt;
          &lt;conversionPattern value=&quot;%date %level %logger - %message%newline&quot; /&gt;           
        &lt;/layout&gt;
      &lt;/appender&gt;
    &lt;/log4net&gt;
    &lt;root&gt;
      &lt;level value=&quot;INFO&quot;/&gt;
      &lt;appender-ref ref=&quot;ConsoleAppender&quot;/&gt;
    &lt;/root&gt;
      &lt;startup&gt; 
          &lt;supportedRuntime version=&quot;v4.0&quot; sku=&quot;.NETFramework,Version=v4.7.2&quot; /&gt;
      &lt;/startup&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>My LogHelper Class:</p>
  <pre><code>public class LogHelper
  {
      public static log4net.ILog GetLogger([CallerFilePath]string filename = &quot;&quot;)
      {
          return log4net.LogManager.GetLogger(filename);
      }
  }
  </code></pre>
  <p>That is how I am using it in my main class Program.cs</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  
  [assembly: log4net.Config.XmlConfigurator(Watch = true)]
  
  
  namespace Shopping_List
  {
      class Program
      {
          private static readonly log4net.ILog log = LogHelper.GetLogger(); //log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
  
          private static void Main()
          {
              log.Info(&quot;This is info message&quot;);
              MyClass newClass = new MyClass();
  
              newClass.MyMethod();
  
              log.Info(&quot;This is info message&quot;);
  
              Console.ReadKey();
  
          }
      }
  
   
      
  }
  </code></pre>
  <p>and here is my other class</p>
  <pre><code>public class MyClass
  {
  
      //var itemList = new List&lt;string&gt;();
      List&lt;String&gt; itemList = new List&lt;string&gt;();
      int choices;
  
      public void MyMethod()
      {
          //var itemList = new List&lt;string&gt;();
          //int choices;
  
          while (true)
          {
  
              try
              {
                  
  
                  Console.WriteLine(&quot;Shopping list:\n1. Add to list\n2. Remove from list\n3. List the items on the shopping list\n4. Exit&quot;);
                  choices = Convert.ToInt32(Console.ReadLine());
  
              }
  
              catch (Exception)
              {
                  Console.WriteLine(&quot;\n &quot;);
                  Console.WriteLine(&quot;You have Entered non-numeric value, you can only choose between 1 to 4&quot;);
                  Console.WriteLine(&quot;\n &quot;);
              }
  
              Console.WriteLine(&quot;\n &quot;);
  
  
                  if (choices == 1)
                  {
                      itemAdded();
                  }
  
                  else if (choices == 2)
                  {
                      itemRemoved();
                  }
  
                  else if (choices == 3)
                  {
                      readList();
                  }
  
                  else if (choices == 4)
                  {
                      //break;
                      Environment.Exit(0);
                      
                  }
                  else
                  {
                      Console.WriteLine(&quot;please enter valid choice!!!&quot;);
                  }
  
          
             
          }
  
  
      }
  
      public void itemAdded()
      {
  
          //var itemList = new List&lt;string&gt;();
  
          
  
          Console.WriteLine(&quot;\nWhat would you like to add in the list?&quot;);
          string itemAdded = Console.ReadLine();
  
          if (string.IsNullOrEmpty(itemAdded))
          {
              Console.WriteLine(&quot;you add nothing!!!&quot;);
          }
          else
          {
              itemList.Add(itemAdded);
              Console.WriteLine(itemAdded + &quot; is added to the list&quot;);
          }
      }
  
      public void itemRemoved()
      {
  
          //var itemList = new List&lt;string&gt;();
  
          Console.WriteLine(&quot;\nWhat would you like to remove from the list?&quot;);
          string itemToRemove = Console.ReadLine();
  
          if (string.IsNullOrEmpty(itemToRemove))
          {
              Console.WriteLine(&quot;you removed nothing&quot;);
          }
          else
          {
              bool isMatch = false;
              foreach (string item in itemList)
              {
                  if (item == itemToRemove)
                  {
                      isMatch = true;
                  }
              }
              if (isMatch)//if ismatch is true
              {
                  itemList.Remove(itemToRemove);
                  Console.WriteLine(itemToRemove + &quot; is successfully removed from your list&quot;);
              }
              else
              {
                  Console.WriteLine(&quot;Item is not in the list&quot;);
              }
          }
  
      }
  
      public void readList()
      {
          //var itemList = new List&lt;string&gt;();
  
          foreach (string item in itemList)
          {
              Console.WriteLine(item);
          }
      }
  
  
  }
  </code></pre>
  <p>I am not using log4net in myClass.</p>