title: Log4net for windows service
body: <p>This is first time I am using <code>Log4net</code>. It doesn't show any errors, but is not writing to file. I added following in my <code>AppConfig</code> file:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;configuration&gt;
      &lt;configSections&gt;
          &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" requirePermission="false"/&gt;
      &lt;/configSections&gt;
  
   &lt;log4net&gt;
      &lt;appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"&gt;
        &lt;layout type="log4net.Layout.PatternLayout"&gt;
          &lt;conversionPattern value="%5level [%thread] (%file:%line) - %message%newline"/&gt;
        &lt;/layout&gt;
      &lt;/appender&gt;
  
      &lt;appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
        &lt;file value="C:\CE\FileControllerLog.txt"/&gt;
        &lt;layout type="log4net.Layout.PatternLayout"&gt;
          &lt;!--&lt;param name="ConversionPattern" value="%d [%t] %-5p %c %m%n"/&gt;--&gt;
          &lt;param name="ConversionPattern" value="%d %m%n"/&gt;
        &lt;/layout&gt;
        &lt;appendToFile value="true"/&gt;
        &lt;rollingStyle value="Composite"/&gt;
        &lt;maxSizeRollBackups value="2"/&gt;
        &lt;maximumFileSize value="10MB"/&gt;
        &lt;staticLogFileName value="true"/&gt;
      &lt;/appender&gt;
      &lt;logger name="FileControllerLog"&gt;
        &lt;level value="INFO"/&gt;
        &lt;appender-ref ref="LogFileAppender" /&gt;
        &lt;appender-ref ref="ConsoleAppender"/&gt;
      &lt;/logger&gt;
  </code></pre>
  
  <pre class="lang-cs prettyprint-override"><code>[assembly: log4net.Config.XmlConfigurator(Watch = true)] //added in assembly info file
  </code></pre>
  
  <p>and in code:        </p>
  
  <pre class="lang-cs prettyprint-override"><code>ILog logger = log4net.LogManager.GetLogger("FileControllerLog");
  logger.Info("Method starts");
  </code></pre>
  
  <p>It's not logging.</p>