title: use log4net without web.config
body: <p>I am using log4net to log the errors.</p>
  
  <p>Currently I downloaded the file <code>log4net.dll</code>, then made the following change in <code>global.asax</code> file:</p>
  
  <pre><code>private static ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  
  protected void Application_Start(object sender, EventArgs e)
  {
      log4net.Config.XmlConfigurator.Configure();
  }
  protected void Application_Error(object sender, EventArgs e)
  {
      Log.Fatal("An uncaught exception occurred", this.Server.GetLastError());
  }
  </code></pre>
  
  <p>also these changes were made in the web.config file</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;log4net&gt;
  
  &lt;appender name="LogFileAppender" type="log4net.Appender.FileAppender"&gt;
    &lt;param name="File" value="c:\Log4NetExample.log"/&gt;
    &lt;layout type="log4net.Layout.PatternLayout"&gt;
      &lt;param name="ConversionPattern" value="%d [%t] %-5p %c %m%n"/&gt;
    &lt;/layout&gt;
  &lt;/appender&gt;
  
  &lt;root&gt;
  
    &lt;level value="All"/&gt;
  
    &lt;appender-ref ref="LogFileAppender"/&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p></p>
  
  <p>everything works.. but what I need is to move the code from the <code>web.config</code> and read it from a text file instead.</p>
  
  <p>Also I need 2 levels of debug and error..</p>
  
  <p>Can anyone help me with this?</p>
  
  <p>Thank you</p>