Code
protected void WriteLog(string message)
{
string varAppPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "log";
System.IO.Directory.CreateDirectory(varAppPath);
string head = System.DateTime.Now.Hour.ToString() + ":" + System.DateTime.Now.Minute.ToString() + ":" + System.DateTime.Now.Second.ToString() + ":" + System.DateTime.Now.Millisecond.ToString();
string logMessage = head + System.Environment.NewLine + message + System.Environment.NewLine;
string strDate = System.DateTime.Now.ToString("yyyyMMdd");
string strFile = varAppPath + "\\" + strDate + ".log";
StreamWriter SW = new StreamWriter(strFile, true);
SW.WriteLine(logMessage);
SW.Flush();
SW.Close();
}
protected void WriteLog(string message)
{
string varAppPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "log";
System.IO.Directory.CreateDirectory(varAppPath);
string head = System.DateTime.Now.Hour.ToString() + ":" + System.DateTime.Now.Minute.ToString() + ":" + System.DateTime.Now.Second.ToString() + ":" + System.DateTime.Now.Millisecond.ToString();
string logMessage = head + System.Environment.NewLine + message + System.Environment.NewLine;
string strDate = System.DateTime.Now.ToString("yyyyMMdd");
string strFile = varAppPath + "\\" + strDate + ".log";
StreamWriter SW = new StreamWriter(strFile, true);
SW.WriteLine(logMessage);
SW.Flush();
SW.Close();
}