TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ashok kallagunta
NA
118
19.5k
How to create error log in MVC 5
May 30 2017 3:28 AM
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.
Reply
Answers (
3
)
How can check double extensions in file while file uploading
WebAPI in Asp.NET MVC