if (!Directory.Exists("C:\testll")) { Directory.CreateDirectory("C:\testll"); } string LogAddress = "C:\testll\Test_Log.log"; string LogAddress2 = "C:\testll\Test_Log2.log"; //测试 FileStream fs = new FileStream(LogAddress, FileMode.OpenOrCreate); using(StreamWriter swr = new StreamWriter(fs)) { swr.WriteLine("Test1"); swr.WriteLine("Test1"); swr.WriteLine("Test1"); swr.WriteLine("Test1"); swr.WriteLine(); } using(StreamWriter sw = new StreamWriter(LogAddress2, true)) { sw.WriteLine("Test2"); sw.WriteLine("Test2"); sw.WriteLine("Test2"); sw.WriteLine(); }