newbie: logging exceptions, how??

J

Jeff

ASP.NET 2.0

I'm developing a ASP.NET 2.0 portal and are wondering how to implement some
kind of logging which logs all the exceptions which occur while the website
is running, So the administrator can view the log and discover problems,
like the website trying to access a page on another server, and this server
is down. Then it would be nice if problems like this could be logged!

I've looked into healthmonitoring and the EventLog class, What do you
recommend me to use? I think healthmonitroing is best but it's just that I
don't know how to use it. But I can learn :)

Regarding healthmonitoring, this code below will of course throw an
exception. How do I know that healthmonitoring will log this error?
try{
int i = null;
int result = 100/i;
}
catch (Exception e) {
}

Best Regards!

Jeff
 
M

Michael Nemtsev

Hello jeff,

U can just rethrow your errors in catch or dont use the catch, but handle
all error in Application_Error method at global.asax

Health Monitoring is just set of service methods which helps you to write
your errors to the desired source, such as eventLog, or file or send via
email

---
WBR, Michael Nemtsev [.NET/C# MVP].
My blog: http://spaces.live.com/laflour
Team blog: http://devkids.blogspot.com/

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

j> ASP.NET 2.0
j>
j> I'm developing a ASP.NET 2.0 portal and are wondering how to
j> implement some kind of logging which logs all the exceptions which
j> occur while the website is running, So the administrator can view the
j> log and discover problems, like the website trying to access a page
j> on another server, and this server is down. Then it would be nice if
j> problems like this could be logged!
j>
j> I've looked into healthmonitoring and the EventLog class, What do you
j> recommend me to use? I think healthmonitroing is best but it's just
j> that I don't know how to use it. But I can learn :)
j>
j> Regarding healthmonitoring, this code below will of course throw an
j> exception. How do I know that healthmonitoring will log this error?
j> try{
j> int i = null;
j> int result = 100/i;
j> }
j> catch (Exception e) {
j> }
j> Best Regards!
j>
j> Jeff
j>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top