title: How to create log.txt using log4net?
body: <p>I'm able to create logs but unable to write exception string to it...the logs.txt remains empty...</p>
  
  <p>This is the catch block : </p>
  
  <pre><code> catch (Exception ex)
              {
                  Logging.LogError(ex.ToString());
                  return new DataTable();
              }
  </code></pre>
  
  <p>Logging.cs : </p>
  
  <pre><code>public class Logging
  {
      public readonly ILog log = LogManager.GetLogger(typeof(Logging));
      public static void LogError(string exception)
      {
          log4net.Config.XmlConfigurator.Configure();
      }
  }
  </code></pre>
  
  <p>web config : </p>
  
  <pre><code>&lt;log4net&gt;
      &lt;appender name="file" type="log4net.Appender.RollingFileAppender"&gt;
        &lt;file type="log4net.Util.PatternString" value="Logs\Log_%date{dd-MM-yyyy_HH-mm-ss}.txt"/&gt;
        &lt;appendToFile value="true"/&gt;
        &lt;maxSizeRollBackups value="-1"/&gt;
        &lt;!--infinite--&gt;
        &lt;staticLogFileName value="true"/&gt;
        &lt;rollingStyle value="Once"/&gt;
        &lt;layout type="log4net.Layout.PatternLayout"&gt;
          &lt;conversionPattern value="%date %-5level %message%newline"/&gt;
        &lt;/layout&gt;
      &lt;/appender&gt;
      &lt;root&gt;
        &lt;level value="ALL"/&gt;
        &lt;appender-ref ref="file"/&gt;
      &lt;/root&gt;
    &lt;/log4net&gt;
  </code></pre>