I am trying to publish a service and I am having issues (on the networkers side), so I am trying to write some exception logging to help them along.
StreamWriter log;
if (!File.Exists("C:\\Projects\\logfile.txt"))
{
log = new StreamWriter("C:\\Projects\\logfile.txt");
}
else
{
log = File.AppendText("C:\\Projects\\logfile.txt");
throw new Exception();
}
log.WriteLine(DateTime.Now);
log.WriteLine("StartProcessing");
log.WriteLine();
log.Close();
I have this set up about 4 different places because I feel that's where the error is...
My big question is if I need to write something to modify the file after it's been created, because currently only the first place I put this code actually puts in the WriteLine stuff.