/// <summary>
/// 写入信息
/// </summary>
/// <param name="Path">地址</param>
/// <param name="Msg">信息</param>
private static void WriteRecordFile(string Path, string Msg)
createFile(Path);
using (StreamWriter writer = new StreamWriter(Path, true))
{
writer.WriteLine("Error:" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now) + " " + Msg + "\n");
writer.Close();
writer.Dispose();
}
}
private static void createFile(string Path)
{
if (!File.Exists(Path))
File.Create(Path);
}
/// 写入信息
/// </summary>
/// <param name="Path">地址</param>
/// <param name="Msg">信息</param>
private static void WriteRecordFile(string Path, string Msg)
{
Path = System.Web.HttpContext.Current.Server.MapPath("/") + Path;//写入地址createFile(Path);
using (StreamWriter writer = new StreamWriter(Path, true))
{
writer.WriteLine("Error:" + string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now) + " " + Msg + "\n");
writer.Close();
writer.Dispose();
}
}
private static void createFile(string Path)
{
if (!File.Exists(Path))
File.Create(Path);
}