Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a Site set up that a 3rd party service hits every so often via a webhook. We've noticed that there is an error every so often, but the webhook fires frequently enough that it is hard to catch it within 20 debug logs (let alone remembered to reset the debug log for the site user). Is there a better way to try to capture the debug log automatically in this case? It doesn't sound like there is a way to force the debug logs to capture indefinitely, and I'm not entirely sure where the error ends up happening (could be bad parsing of a character in the request body, could be a DMLException, etc). In our case, the DML occurs in @future methods, but most of the parsing occurs when the endpoint is hit (APEX controller).

share|improve this question
I'll add what I've done in the past is just set up try/catch blocks and send an email out when an exception triggers, but I'm curious whether that is the best solution. – Michael Welburn Feb 22 '13 at 22:52
An option is when you catch the Exception that is thrown to interrogate it and save its details to a custom setting or a custom object. This way it gets stored and you can view easily and indefinitely. – pbattisson Feb 25 '13 at 22:34
up vote 4 down vote accepted

We put a google analytics event on the error page (exception) that's passing back the exception text and the retUrl as values.

It isn't a full debug trace, but it at least tells us how many we have, what types, and what pages cause it so we can start the hunt.

ga event documentation

share|improve this answer
that's an amazing idea, wow – Ralph Callaway Feb 24 '13 at 23:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.