Write to log file

Niladri.Biswas
Posted by Niladri.Biswas under C# category on | Points: 40 | Views : 808
public static void WriteLog(string message)
{
try
{
FileStream fs = new FileStream("test.log", FileMode.Append);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine(DateTime.Now + ": " + message);
sw.Close();
}
catch { }
}

Comments or Responses

Login to post response