We have a Force.com 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).

  • 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

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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