leora
leora

Reputation: 196881

ASP.NET MVC exception logging

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());
}

Upvotes: 2

Views: 1643

Answers (1)

Richard Banks
Richard Banks

Reputation: 12546

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.

Upvotes: 5

Related Questions