using System; using System.Collections.Generic; using System.Text; using System.Data.SqlClient; using System.Web; namespace Common { public class LogHelper : System.Web.UI.Page { private static HttpContext myContext = HttpContext.Current; /// <summary> /// 写日志 /// </summary> /// <param name="Path"></param> /// <param name="InfoStr"></param> public static void WriteLog(string InfoStr) { System.IO.StreamWriter sw = new System.IO.StreamWriter(myContext.Server.MapPath("/log/cps_log" + DateTime.Now.ToString("yyyyMMdd") + ".txt"), true, System.Text.Encoding.UTF8); sw.WriteLine(DateTime.Now); sw.WriteLine(InfoStr); sw.WriteLine(""); sw.Close(); sw.Dispose(); } } }