title: How do I output console to multiple streams at once in C#?
body: <p>I have a program that takes the Console output and writes it to a logfile, however it no longer shows up in the console window. Is there a way to keep it in the window but write it to the log file as well?</p>
  
  <p><strong>Update:</strong></p>
  
  <pre><code>appLogStream = new FileStream(logFile, FileMode.Append, FileAccess.Write, FileShare.Read);
  TextWriter logtxtWriter = Console.Out;
  logstrmWriter = new StreamWriter(appLogStream);
  if(!console) Console.SetOut(logstrmWriter);
  logstrmWriter.AutoFlush = true;
  Console.WriteLine("Started at " + DateTime.Now);
  </code></pre>
  
  <p>console is a constant set in the class. It basically tells it whether it is using the console window or not (readline is not called, etc, if not in console).</p>
  
  <p>So is there a way to write to both the console and the file?</p>