string path= System.Windows.Forms.Application.StartupPath + "\\ErrorLog\\"+fileName +".txt";
            if (!File.Exists(path))
            {
                FileInfo myfile = new FileInfo(path);
                FileStream fs = myfile.Create();
                fs.Close();
            }
            StreamWriter sw = File.AppendText(path);
            sw.WriteLine(errorMsg);
            sw.Flush();
            sw.Close();

posted on 2012-05-24 09:08  swarb  阅读(1371)  评论(0编辑  收藏  举报