I have created a project in MVC5, I want to create an error log for same.
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.