الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

bug raportingاي ادات تستعملون

بدأه زكيري عبد العالي في 13 ديسمبر 2011 · 11 رد · 2,139 مشاهدة · في ASP.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكم

هل من الممكن ان اعرف اي ادات تستعملون في عرض او ارسال رساءل تنيه عند حدوث خطأ except في البرنامج او الموقع في السايق كنت استعمل احد الادوات التي اجدها رائعة مع الدلفي و هي MadExcept

فهل يوجد شيئ كهدا يمكن اضافته على VS2010

شكرا .

#2

لا تستعملون ه\ه الادوات .

طيب هل في علي ان ابرمج كلاس تقوم بانشاء ملفات log و ارسال الميل في حاله كل خطأ try catch

شكرا

#3

السلام عليكم ورحمه الله وبركاته

اخي يمكنك استخدام الفئة EventLog شوف الرابط التالي http://support.microsoft.com/kb/815314

1

.:: Wish to become better and better ::.

#4

بارك الله فيك اخي VB Helper

نجحة الفكرة لكن الان بما ان الخادم به عدة مشاريع اريد ان اقوم بفلترة و اجمع جمبع الرساءل الخاصة بمشروعي في view اسمه MatrixAdminDev

لم اجد اسم المشروع او شئ اخر يجعلني افرق بين الرسائل

شكرا .

post-1034-090201300 1324307275_thumb.jpg

المرفقات
Rp-erreur.JPG
#5

الملخص :

1- اضفت الكود التالي في Global.asax

 void Application_Error(object sender, EventArgs e)
    {
        Exception exception = Server.GetLastError();

        if (exception != null)
        {
                Tool.ExceptionSend(exception, Request);
        }
    }

 public static void ExceptionSend(Exception exception, HttpRequest request)
    {


        string message = "<table width=\"85%\" border=\"0\" align=\"center\" cellpadding=\"5\" cellspacing=\"1\" style='background-color: #000099;'>";
        message += "<tr bgcolor=\"#eeeeee\">";
        message += "<td colspan=\"2\" style='font-family: Verdana;font-size: 12px;color: #000099;font-weight: bold;'>Page Error</td>";
        message += "</tr>";

        if (exception.Message != null)
        {
        message += "<tr>";
        message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>Error</td>";
        message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + exception.Message.ToString() + "</td>";
        message += "</tr>";
        }

        if (exception.InnerException != null)
        {
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>Details</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + exception.InnerException.Message.ToString() + "</td>";
            message += "</tr>";
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>Stack Trace</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + exception.InnerException.StackTrace.ToString() + "</td>";
            message += "</tr>";
        }

        if (request.Url.AbsoluteUri != null)
        {
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>URL</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + request.Url.AbsoluteUri.ToString() + "</td>";
            message += "</tr>";
        }

        if (request.Url.AbsoluteUri != null)
        {
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>Request Host</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + request.UserHostAddress.ToString() + "</td>";
            message += "</tr>";
        }

        if (request.UserHostName != null)
        {
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>Host Name</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + request.UserHostName.ToString() + "</td>";
            message += "</tr>";
        }

        if (request.UserAgent != null)
        {
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>User Agent</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + request.UserAgent.ToString() + "</td>";
            message += "</tr>";
        }

        if (request.UrlReferrer != null)
        {
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>URL Referrer</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + request.UrlReferrer.ToString() + "</td>";
            message += "</tr>";
        }

        if (request.LogonUserIdentity != null)
        {
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>UserName</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + request.LogonUserIdentity.Name.ToString() + "</td>";
            message += "</tr>";
        }

        if (exception.TargetSite != null)
        {
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>Method</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + exception.TargetSite.ToString() + "</td>";
            message += "</tr>";
        }

        if (exception.Source != null)
        {
            message += "<tr>";
            message += "<td width=\"100\" align=\"right\" bgcolor=\"#eeeeee\" style='font-family: Verdana;font-size: 11px;color: #000099;font-weight: bold;' nowrap>Source</td>";
            message += "<td bgcolor=\"#FFFFFF\" style='font-family: Verdana;font-size: 11px;'>" + exception.Source.ToString() + "</td>";
            message += "</tr>";
        }


        message += "</table>";

        string subject = string.Format("[{0}]: {1}   ", sMatrixAdminError, DateTime.Now.ToString());

        Tool.EmailSend(sDevMatrixEmail, sNoReplyEmail, subject, message);
    }

و في Web.config

 <!-- zekiri -->
    <customErrors mode="On">
      <error statusCode="118" redirect="InternalError.aspx?err=118" />
      <error statusCode="400" redirect="InternalError.aspx?err=400" />
      <error statusCode="404" redirect="InternalError.aspx?err=404" />
      <error statusCode="500" redirect="InternalError.aspx?err=500" />
      <error statusCode="504" redirect="InternalError.aspx?err=504" />
    </customErrors>

في الموقع اشتغلت الامور بشكل جيد و الحمد لله

و الان اريد اضافة نفس الطريقة في منضومة خدمة WCF لكن لم اتحصل على النتيجة لانه اعتقد المشكلة في APP.config

ارجوا المساعدة في كيفة وضع bug raporting في WCF

شكرا

#6

السلام عليكم

هناك ادوات كثيرة انظر الى هذه المقالة http://www.dotnetlogging.com/

واستخدم في مشاريعي log4net حيث يوجد عدة خيارات لتوثيق الاخطاء منها التخزين الى ملفات او ارسال ايميل .

#7

شكرا على سرعة الرد و على هده الادات.

لكن احببت ان اكمل مع EventLog و لا تتطلب اضافت مكتبات و لا اكواد كثيرة .

#10

في WCF الامر مختلف عن التطبيقات العادية ومختلف عن الويب حيث لايوجد entry point لذا عليك بفهم الطريقة التي ذكرتها في مقالتك السابقة والرجوع الى المقالة IErrorHandler Interface

ملاحظة :بالنسبة ل Event log لايستخدم في الويب كثيرا بسبب الحاجة الى الصلاحيات وبالتالي لن يعمل في شركات الاستضافة تحت Medium trust

#11

لقد استعملت LOG4NET

شكرا

#12
اقتباس
لقد استعملت LOG4NET

ان شاء الله خيار موفق .

منذ فترة وانا استخدم هذه المكتبة وقبل ان اتعرف عليها كنت استخدام ادوات من عملي لكني وجدت ان هذه المكتبة افضل فانتقلت لها .

واهم ميزاتها

  • يمكن التحكم بها من خلال config file .
  • التحكم بحجم الملفات او انشاء عدة ملفات مثلا حسب التاريخ او حجم الملف
  • التحكم في ما تريد تسجيله او ايقاف التسجيل كاملا
  • عدة خيارات للتسجيل منها الملفات او الايميل او مسجل النظام
  • تعمل في الويب وفي التطبيقات العادية

مواضيع مشابهة