title: Redirect output window to log file
body: <p>When my app starts, I see that following lines are written to the output window:</p>
  
  <pre><code>'MyApp.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\PresentationFramework.Luna\3.0.0.0__31bf3856ad364e35\PresentationFramework.Luna.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  'MyApp.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\PresentationFramework.Aero\3.0.0.0__31bf3856ad364e35\PresentationFramework.Aero.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  'MyApp.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\PresentationFramework.resources\3.0.0.0_nl_31bf3856ad364e35\PresentationFramework.resources.dll'
  'MyApp.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Data.SqlServerCe\3.5.1.0__89845dcd8080cc91\System.Data.SqlServerCe.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  'MyApp.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_32\System.Transactions\2.0.0.0__b77a5c561934e089\System.Transactions.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  'MyApp.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  'MyApp.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Data.resources\2.0.0.0_nl_b77a5c561934e089\System.Data.resources.dll'
  'MyApp.exe' (Managed (v2.0.50727)): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
  'MyApp.exe' (Managed (v2.0.50727)): Loaded 'Anonymously Hosted DynamicMethods Assembly'
  </code></pre>
  
  <p>I like to add these lines to my log file (and assign timestamp) for some performance measurements. I've tried to do that with the following class I created.</p>
  
  <pre><code>public static class ConsoleLogger
  {
      public class LogWriter : TextWriter
      {
          public LogWriter()
          {
          }
  
          public override Encoding Encoding
          {
              get { return Encoding.UTF8; }
          }
  
          public override void Write(string value)
          {
              Logger.Info(value);                
          }
      }
  
      public static void RedirectConsoleLog()
      {
          Console.SetOut(new LogWriter());
      }
  }
  </code></pre>
  
  <p>But this doesn't work. The Write() method is never called. Any ideas?</p>