title: Can you configure log4net in code instead of using a config file?
body: <p>I understand why log4net uses <code>app.config</code> files for setting up logging - so you can easily change how information is logged without needing to recompile your code. But in my case I do not want to pack a <code>app.config</code> file with my executable. And I have no desire to modify my logging setup.</p>
  
  <p>Is there a way for me to set up logging in code rather than using the <code>app.config</code>?</p>
  
  <p>Here is my simple config file:</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="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
        &lt;file value="Logs\EventLog.txt" /&gt;
        &lt;appendToFile value="false" /&gt;
        &lt;rollingStyle value="Size" /&gt;
        &lt;maxSizeRollBackups value="5" /&gt;
        &lt;maximumFileSize value="1GB" /&gt;
        &lt;layout type="log4net.Layout.PatternLayout"&gt;
          &lt;conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /&gt;
        &lt;/layout&gt;
      &lt;/appender&gt;
      &lt;appender name="MemoryAppender" type="log4net.Appender.MemoryAppender"&gt;
      &lt;/appender&gt;
      &lt;root&gt;
        &lt;level value="Info" /&gt;
        &lt;appender-ref ref="RollingLogFileAppender" /&gt;
        &lt;appender-ref ref="MemoryAppender" /&gt;
      &lt;/root&gt;
    &lt;/log4net&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>To be completely clear: It is my goal to have no XML file. Not even as an embedded resource that I turn into a stream. My goal was to define the logger completely programmatically. Just curious if it's possible and if so where I might find an example of the syntax.</p>