Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
How to create error log in MVC 5
ashok kallagunta
May 30 2017 3:28 AM
418
Reply
I have created a project in MVC5, I want to create an error log for same.
is there any way that we can get detailed information about the error.
as of now, i am catching exception like below.
catch (Exception Ex)
{
mailobj.SendMail(
this.ControllerContext.RouteData.Values["controller"].ToString(),
this.ControllerContext.RouteData.Values["action"].ToString(),
Convert.ToString(Ex.Message.Replace("<", "").Replace(">", "").ToString()),
Convert.ToString(Ex.HelpLink),
Convert.ToString(Ex.Source),
Convert.ToString(Ex.StackTrace),
Convert.ToString(Ex.TargetSite));
return Json("error in the system.!", JsonRequestBehavior.AllowGet);
}
hear send mail will send mail to admin about error.
but the problem is, I could not able to get complete details about the error for example, if you get error message like "
Object reference not set to an instance of an object.
" I want to to what is the parameter value to get this data.
Is there any easy way that we can track the errors in the system.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
How can check double extensions in file while file uploading
WebAPI in Asp.NET MVC