Showing posts with label exceptions. Show all posts
Showing posts with label exceptions. Show all posts

Monday, March 26, 2012

newbie: logging exceptions, how?

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!
JeffHello 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>
Jeff,
You may want to look at the Enterprise Library at
http://www.codeplex.com/entlib There's a loggin application block that
should do the trick for you and it's very adaptable.
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199...2006
"Jeff" <it_consultant1@.hotmail.com.NOSPAM> wrote in message
news:%23tVbkvwnHHA.596@.TK2MSFTNGP06.phx.gbl...
> 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
>

newbie: logging exceptions, how?

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!

JeffHello 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

jASP.NET 2.0
j>
jI'm developing a ASP.NET 2.0 portal and are wondering how to
jimplement some kind of logging which logs all the exceptions which
joccur while the website is running, So the administrator can view the
jlog and discover problems, like the website trying to access a page
jon another server, and this server is down. Then it would be nice if
jproblems like this could be logged!
j>
jI've looked into healthmonitoring and the EventLog class, What do you
jrecommend me to use? I think healthmonitroing is best but it's just
jthat I don't know how to use it. But I can learn :-)
j>
jRegarding healthmonitoring, this code below will of course throw an
jexception. How do I know that healthmonitoring will log this error?
jtry{
jint i = null;
jint result = 100/i;
j}
jcatch (Exception e) {
j}
jBest Regards!
j>
jJeff
j>
Jeff,
You may want to look at the Enterprise Library at
http://www.codeplex.com/entlib There's a loggin application block that
should do the trick for you and it's very adaptable.

--
Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Jeff" <it_consultant1@.hotmail.com.NOSPAMwrote in message
news:%23tVbkvwnHHA.596@.TK2MSFTNGP06.phx.gbl...

Quote:

Originally Posted by

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
>

Thursday, March 22, 2012

newbiew ( debugging question )

iam new to asp.net debugging, i was just wondering if there was any
option in the IDE which i can change to throw all the exceptions in the
IDE while deugging, something like VB 6's 'break on all errors' ?
TIA
-ashishThat is turned on by default.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Ashish" <asharma@.mailmenot.com> wrote in message
news:uBpQXlknDHA.2000@.TK2MSFTNGP12.phx.gbl...
> iam new to asp.net debugging, i was just wondering if there was any
> option in the IDE which i can change to throw all the exceptions in the
> IDE while deugging, something like VB 6's 'break on all errors' ?
> TIA
> -ashish
Kevin Spencer wrote:
> That is turned on by default.
but it is nt stopping when an unhandled error is raised ?, i want it to
tell me while debugging, where (exact line ) the error occured
is that possible with asp.net pages debugging ?
-ashish
Well, if you go to your Debug menu, and select "Exceptions" you can
customize how and when your debugger breaks in every conceivable way.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big Things are made up of
Lots of Little Things.

"Ashish" <asharma@.mailmenot.com> wrote in message
news:OvArLCxnDHA.2964@.tk2msftngp13.phx.gbl...
> Kevin Spencer wrote:
> > That is turned on by default.
> but it is nt stopping when an unhandled error is raised ?, i want it to
> tell me while debugging, where (exact line ) the error occured
> is that possible with asp.net pages debugging ?
> -ashish