You can use the Log4Net library.
It can write simultaneously to a file and a console, as well as to any other place (for example, a database), has flexible settings, supports multithreading.
And do not reinvent the wheel.
You can also do this:
static void Main(string[] args) { Trace.Listeners.Clear(); TextWriterTraceListener twtl = new TextWriterTraceListener(Path.Combine(Path.GetTempPath(), AppDomain.CurrentDomain.FriendlyName)); twtl.Name = "TextLogger"; twtl.TraceOutputOptions = TraceOptions.ThreadId | TraceOptions.DateTime; ConsoleTraceListener ctl = new ConsoleTraceListener(false); ctl.TraceOutputOptions = TraceOptions.DateTime; Trace.Listeners.Add(twtl); Trace.Listeners.Add(ctl); Trace.AutoFlush = true; Trace.WriteLine("The first line to be in the logfile and on the console."); }
Taken from here:
https://stackoverflow.com/questions/420429/mirroring-console-output-to-a-file