C#的FTP服务器软件系统的设计与实现(15)
时间:2017-04-28 09:26 来源:毕业论文 作者:毕业论文 点击:次
StringBuilder SB = new StringBuilder(); if (LogStream.Length < 21) SB.AppendLine("<ERRORLOG>"); else LogStream.Position = LogStream.Length - 13; SB.AppendLine(" <LOG TIME=\"{0}\" SOURCE=\"{1}\">"); SB.AppendLine(" <EXCEPTION>{2}</EXCEPTION>"); SB.AppendLine(" <MESSAGE>{3}</MESSAGE>"); SB.AppendLine(" <SOURCE>{4}</SOURCE>"); SB.AppendLine(" <STACK>{5}</STACK>"); SB.AppendLine(" <TARGETSITE>{6}</TARGETSITE>"); SB.AppendLine(" </LOG>"); SB.AppendLine("</ERRORLOG>"); // End the xml file Log.Write( string.Format(SB.ToString(), DateTime.Now.ToString("HH:mm:ss"), Source.ToString(), Ex.ToString(), Ex.Message, Ex.Source, Ex.StackTrace, Ex.TargetSite.Name)); SB = null; } catch (Exception Exn) { } finally { if (Log != null) Log.Close(); Log = null; if (LogStream != null) LogStream.Close(); LogStream = null; (责任编辑:qin) |