using System;
using System.IO;
class MainClass {
publicstaticvoid Main() {
StreamWriter log_out;
try {
log_out = new StreamWriter("logfile.txt");
}
catch(IOException exc) {
Console.WriteLine(exc.Message + "Cannot open file.");
return ;
}
Console.SetOut(log_out);
Console.WriteLine("This is the start of the log file.");
log_out.Close();
}
}