2

i have just taken over an app that has a lot of code like below where exceptions are just caught and Console.Write(xxx) is there.

I would like to change this so i have a simple log to review everything there is a Console.write() now.

What is the simplest way for getting this setup in asp.net mvc to have a file to view on the IIS server.

try
{
    SmtpClient c = new SmtpClient("mail.xxx.org");
    c.Send(msg);
}
catch (Exception ex)
{
    Console.Write(ex.Message.ToString());
}
2
  • 1
    Also, this blog has a good explanation of how to log errors caught by the [HandleError] attribute. Commented Aug 6, 2009 at 5:28
  • There are other similar questions re: ASP.NET MVC. Please see... stackoverflow.com/questions/1032373/… Commented Aug 6, 2009 at 5:32

1 Answer 1

5

You might want to try the ELMAH library.

Check the project site for some examples.

Scott Hanselman has also written a blog post or two about it.

Sign up to request clarification or add additional context in comments.

1 Comment

got setup with this in < 2 mins

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.