views:

341

answers:

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());
}
+5  A: 

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.

Richard Banks
got setup with this in < 2 mins
ooo
+1  A: 

Also, this blog has a good explanation of how to log errors caught by the [HandleError] attribute.

Jim Schubert