title: Windows Service running application using Log4Net
body: <p>In order to move data for a couple products, I have created a C# console application that uses Log4Net to track progress. Log4Net is configured in the console apps App.Config file and currently has two appenders, a ConsoleAppender and a RollingLogFileAppender.</p>
  
  <pre><code>&lt;appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
    &lt;file value="logs\Log.txt" /&gt;
    &lt;appendToFile value="true" /&gt;
    &lt;rollingStyle value="Size" /&gt;
    &lt;maxSizeRollBackups value="10" /&gt;
    &lt;maximumFileSize value="10MB" /&gt;
    &lt;staticLogFileName value="true" /&gt;
    &lt;layout type="log4net.Layout.PatternLayout"&gt;
      &lt;conversionPattern value="%date %-5level %logger %method - %message%newline%exception" /&gt;
    &lt;/layout&gt;
  &lt;/appender&gt;
  &lt;appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"&gt;
    &lt;layout type="log4net.Layout.PatternLayout"&gt;
      &lt;conversionPattern value="%date %-5level %logger %method - %message%newline%exception" /&gt;
    &lt;/layout&gt;
  &lt;/appender&gt;
  &lt;root&gt;
    &lt;level value="DEBUG" /&gt;
    &lt;appender-ref ref="RollingLogFileAppender" /&gt;
    &lt;appender-ref ref="ConsoleAppender" /&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>This application and its logging are working when run standalone. Now in order to automate the running of this console app, I am creating Windows Service to run the console app. The application does not require any user input so I did predict any issues when running it through the service. When the service runs it successfully calls the console application and I can see the results of its work, however, the logging does not seem to working. The logs at the location of the executable being called are not changing and I cannot find another instance of the log elsewhere on my machine. The service is running as LocalSystem so permissions should not be an issue. I have tried calling the application with the following settings:</p>
  
  <pre><code>ProcessStartInfo processStartInfo = new ProcessStartInfo(@"C:\Constellation\Dev\Caelum\Caelum\bin\Debug\Caelum.exe");
  processStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
  processStartInfo.CreateNoWindow = true;
  processStartInfo.UseShellExecute = false;
  processStartInfo.RedirectStandardError = true;
  processStartInfo.RedirectStandardInput = true;
  processStartInfo.RedirectStandardOutput = true;
  </code></pre>
  
  <p>I have tried both with and without the output redirects and neither worked. Any suggestions are greatly appreciated.</p>