السلام عليكم
هل من الممكن ان اعرف اي ادات تستعملون في عرض او ارسال رساءل تنيه عند حدوث خطأ except في البرنامج او الموقع في السايق كنت استعمل احد الادوات التي اجدها رائعة مع الدلفي و هي MadExcept
فهل يوجد شيئ كهدا يمكن اضافته على VS2010
شكرا .
لا تستعملون ه\ه الادوات .
طيب هل في علي ان ابرمج كلاس تقوم بانشاء ملفات log و ارسال الميل في حاله كل خطأ try catch
شكرا
السلام عليكم ورحمه الله وبركاته
اخي يمكنك استخدام الفئة EventLog شوف الرابط التالي http://support.microsoft.com/kb/815314
.:: Wish to become better and better ::.
بارك الله فيك اخي VB Helper
نجحة الفكرة لكن الان بما ان الخادم به عدة مشاريع اريد ان اقوم بفلترة و اجمع جمبع الرساءل الخاصة بمشروعي في view اسمه MatrixAdminDev
لم اجد اسم المشروع او شئ اخر يجعلني افرق بين الرسائل
شكرا .
الملخص :
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
شكرا
السلام عليكم
هناك ادوات كثيرة انظر الى هذه المقالة http://www.dotnetlogging.com/
واستخدم في مشاريعي log4net حيث يوجد عدة خيارات لتوثيق الاخطاء منها التخزين الى ملفات او ارسال ايميل .
شكرا على سرعة الرد و على هده الادات.
لكن احببت ان اكمل مع EventLog و لا تتطلب اضافت مكتبات و لا اكواد كثيرة .
وجدت هده الرابطة لكن لم افهم جيدا .
سبحانه الله وبحمده سبحانه الله العظيم
if (You Love ArabTeam2000 ) MessageBox.Show("All ArabTeam2000 Love You"); else MessageBox.Show("go to your mama"); في WCF الامر مختلف عن التطبيقات العادية ومختلف عن الويب حيث لايوجد entry point لذا عليك بفهم الطريقة التي ذكرتها في مقالتك السابقة والرجوع الى المقالة IErrorHandler Interface
ملاحظة :بالنسبة ل Event log لايستخدم في الويب كثيرا بسبب الحاجة الى الصلاحيات وبالتالي لن يعمل في شركات الاستضافة تحت Medium trust
لقد استعملت LOG4NET
شكرا
اقتباسلقد استعملت LOG4NET
ان شاء الله خيار موفق .
منذ فترة وانا استخدم هذه المكتبة وقبل ان اتعرف عليها كنت استخدام ادوات من عملي لكني وجدت ان هذه المكتبة افضل فانتقلت لها .
واهم ميزاتها