Logging exceptions to the windows eventviewer Part 73

  • دعنا نشارك هذا :
ترتيب الدرس : 73
المدة : 00:16:08
التحكم :
Text version of the video
http://csharp-video-tutorials.blogspot.com/2012/12/logging-exceptions-to-windows.html

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation1

Slides
http://csharp-video-tutorials.blogspot.com/2013/08/part-73-logging-exceptions-to-event.html

All ASP .NET Text Articles
http://csharp-video-tutorials.blogspot.com/p/free-aspnet-video-tutorial.html

All ASP .NET Slides
http://csharp-video-tutorials.blogspot.com/p/aspnet-slides.html

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenkat/playlists?view1&sortdd

All Dot Net and SQL Server Tutorials in Arabic
https://www.youtube.com/c/KudvenkatArabic/playlists

In this video we will discuss about logging exceptions to windows eventviewer. In the previous videos we discussed about, creating the custom event log and event source in windows event viewer. Please watch Windows Event Viewer - Part 72, before continuing with this session.

Simplified Log() Method using do-while loop. The complete code for this video can be found at the following URL

http://csharp-video-tutorials.blogspot.com/2012/12/logging-exceptions-to-windows.html

public static void Log(Exception exception)
{
StringBuilder sbExceptionMessagenew StringBuilder();

do
{
sbExceptionMessage.Append("Exception Type" + Environment.NewLine);
sbExceptionMessage.Append(exception.GetType().Name);
sbExceptionMessage.Append(Environment.NewLine + Environment.NewLine);
sbExceptionMessage.Append("Message" + Environment.NewLine);
sbExceptionMessage.Append(exception.Message + Environment.NewLine + Environment.NewLine);
sbExceptionMessage.Append("Stack Trace" + Environment.NewLine);
sbExceptionMessage.Append(exception.StackTrace + Environment.NewLine + Environment.NewLine);

exceptionexception.InnerException;
}
while (exception ! null);

if (EventLog.SourceExists("Hello"))
{
EventLog lognew EventLog("Hello");
log.Source"Hello";
log.WriteEntry(sbExceptionMessage.ToString(), EventLogEntryType.Error);
}
}

سيتم تفعيل التعليقات قريبا

y
Sep 23, 2020 07:32:24
youtube