7

When code in a managed package fails in a customer org it does not produce logs. This is a serious problem for the ISV that needs to provide a fix but is unable to reproduce the bug in his development org.

I expected the "Notify on Apex Error" field on a package to work much better, as I do not receive error emails in all cases and they often miss a helpful stacktrace.

I've heard of custom logging solutions that write custom object records on the customer org, that persist logs and notify the ISV. The problem I see with this solution is that the logging DML might generate limit problems or log records might often not be inserted due to Database rollbacks.

How do you cope with such situations?

7

Subscriber Logging and Full Debug. In the ISVForce Guide, there is a section on supporting your customers, Troubleshooting in Subscriber org.. Note you will need to pass the Security Review to enable Subscriber Support login for you package (as well as a number of other features such as Push Upgrade).

"When logged in as a user in a subscriber’s organization, you can generate Apex debug logs that contain the output from your managed packages. This includes logging that would normally not be exposed to the subscriber. Using this log information, you can troubleshoot issues that are specific to that subscriber organization. "

Custom Object Logging. However some times you do want to capture more functional log entries for review by your users or yourself. In this case managing database transactions is important. Here is an answer I gave before on the topic, Can I prevent an insert to be rolled back even if my class (later) runs into an exception?. Note that a Unit of Work (UOW) pattern is also a good way to create a unique UOW to capture log records outside of your main unit of work and then commit the log entries as shown in the answer in the finally.

  • That's a perfect answer but I wan't to leave the question open to get more feedback. – Robert Sösemann Jul 5 '13 at 9:29
  • 1
    No worries at all, thats what this site is all about! :) – Andrew Fawcett Jul 5 '13 at 9:30
  • I had problems in the past with that solution when I had to debug long running batch processes. I had to stay logged in a the customer and constantly keep my Debug Logs view refreshed and emptied to not run into those occasional "Server errors" where the Dev Console is corrupted and no logs are written anymore. I guess I'll open a seperate question for that. – Robert Sösemann Jul 5 '13 at 9:33
  • 1
    Interesting, yes, perhaps a missing use case in the design of subscriber support? Sounds like a bug (support case) and/or idea to raise perhaps? – Andrew Fawcett Jul 5 '13 at 10:03
  • Did you ask the customer to grant login access to you or use their credentials? If the latter you wouldn't see any info in the logs anyway, but it sounds like the former and you hit a bug. – Matt Lacey Aug 26 '13 at 12:16

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.