简单C#写日志
时间:2011-05-02 来源:土八哥
public static void WriteLogFile(string strLog)
{
string strPath = System.AppDomain.CurrentDomain.BaseDirectory + http://www.cnblogs.com/haiyu/admin/file://\\zztblog.txt;
FileStream fs = new FileStream(strPath, FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine(DateTime.Now.ToString() + ": " + strLog);
m_streamWriter.Flush();
m_streamWriter.Close();
fs.Close();
}
相关阅读 更多 +