• 记录系统日志方法


            private static void SaveLog(string log,string ex)
            {
                string strCurPath = AppDomain.CurrentDomain.BaseDirectory;
                string strErrorLogPath = Path.Combine(strCurPath, "ErrorLog");
                string strErrorLogFile = Path.Combine(strErrorLogPath, "SendEmailLog.log");
                if (!Directory.Exists(strErrorLogPath))
                {
                    Directory.CreateDirectory(strErrorLogPath);
                }
                var fs = new FileStream(strErrorLogFile, FileMode.OpenOrCreate);
                var streamWriter = new StreamWriter(fs);
                streamWriter.BaseStream.Seek(0, SeekOrigin.End);
                streamWriter.WriteLine("系统记录时间:[" + DateTime.Now + "]");
                streamWriter.WriteLine("事件 :"+log);
                streamWriter.WriteLine("错误日志:"+ex);
                streamWriter.WriteLine("");
                streamWriter.Flush();
                streamWriter.Close();
                fs.Close();
            }

  • 相关阅读:
    [SDOI2009]HH的项链
    [PA2010]Riddle
    纪念品
    [Code+#4]最短路
    [JSOI2007]文本生成器
    绝世好题
    一个输入框提示列表效果
    iGOOGLE分栏
    获取图片地址然后显示在input中
    网页配色工具。
  • 原文地址:https://www.cnblogs.com/Linyb/p/2663054.html
Copyright © 2020-2023  润新知