毕业论文

打赏
当前位置: 毕业论文 > 计算机论文 >

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( E



                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; C#的FTP服务器软件系统的设计与实现(15):http://www.751com.cn/jisuanji/lunwen_5865.html
------分隔线----------------------------
推荐内容