标签:length end system ret datetime com flush path cti
public int Log(string info) { info = "-----------------------------" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "-----------------------------\n" + info; FileStream fs = new FileStream(System.Web.HttpContext.Current.Server.MapPath("/log/") + DateTime.Now.ToString("yyyyMMdd") + "log.txt", FileMode.Append); //获得字节数组 byte[] data = System.Text.Encoding.Default.GetBytes(info); //开始写入 fs.Write(data, 0, data.Length); //清空缓冲区、关闭流、销毁 fs.Flush(); fs.Close(); fs.Dispose(); return 1; }
标签:length end system ret datetime com flush path cti
原文地址:http://www.cnblogs.com/math3/p/6646515.html