Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Can I get the stack trace without turning custom errors off?

  Asked By: Lucas    Date: Apr 14    Category: Sharepoint    Views: 1288

I'm trying to capture useful information about errors while still
letting the user see the custom error page.

Most advice out there for debugging is to edit the web.config, change
CustomErrors to "Off" and CallStack to "true". Is there a way to get
the stack trace without turning off custom errors? Just changing
CallStack to "true" doesn't seem to work.

Share: 

 

6 Answers Found

 
Answer #1    Answered By: Lizbeth Macdonald     Answered On: Apr 14

Set custom  errors equal to "RemoteOnly". Then you will get callstack
results when browsing from the server console, but users will get custom
errors (ie, no call stack etc.)

 
Answer #2    Answered By: Cole Curtis     Answered On: Apr 14

I want to capture  the error  as it happens. Also, I'm not sure if this
will work. I know setting CallStack to "true" and CustomErrors to
"On" doesn't work.

 
Answer #3    Answered By: Debbie Snow     Answered On: Apr 14

Is the error  in a web  part or somewhere else? If its in a web part then
you can setup debugging  to step through the code and catch the error.
But you need the source code to do debugging so if its in Microsoft's
code there isn't much you can do.

Please explain a bit more what you are trying to accomplish. Your
original message said you wanted customers to see the CustomErrors, but
you to see the Callstack. That's what setting CustomErrors to
RemoteOnly does. If you browse from the server console you see the
callstack, but anyone coming in across the network sees the custom
error.

 
Answer #4    Answered By: Adalberto Merrill     Answered On: Apr 14

I'm looking at the general case rather than any specific error. Some
messages are not helpful to the user  or to the troubleshooters. For
example "An unexpected error  has occurred" may have any number of
causes, but without a stack trace  it's really hard to pin down.

It's not always possible to locally replicate the error which the user
is experiencing in order to make use of "RemoteOnly". That's why my
goal is to capture  and log the stack trace when the user encounters
the error in the first place.

 
Answer #5    Answered By: Lynsey Carver     Answered On: Apr 14

I understand, but I don't think there is any way to log call stack
traces on all errors.

 
Answer #6    Answered By: Richard Allen     Answered On: Apr 14

If you are trying to capture  unhandled exceptions you might want to
take a look at the "application error" object in global.asax. This
file is in the portal directory in the same place as web.config. The
server.lasterror or something like that (I'm not near the code we
used right now) should give you info about the error  that occured and
if you cast it as an exception you can get the stack trace.

I've never done this on a SharePoint portal, but I've used it in
other asp.net applications to send an e-mail or write to a sql log
table before displaying the custom  error page.

There's some good info that can be found with Google on the subject
if you want to pursue this.

If you write custom code for SharePoint (_layouts applications and
web parts) and handle exceptions, you could always call a logging or
e-mail routine here too so you know what "handled" errors  are
happening too. Most users won't tell you when they see an error.

 




Tagged: