22

how to check debug logs for installed app? Is there any way to check those ? What are the best ways/practice to follow when developing app, so that we can get some logs in case something goes wrong on client installation ?

Basically I am looking for, how to design or develop app so that we can get some info about problems in client org (if something goes wrong).

Thanks in advance.

14

Have a read of the Force.com discussion board post Logging from a deployed managed package. You can use subscriber support from the License Managing Application that is associated with the managed package.

Sadly this won't help you with a beta managed package or one that hasn't passed the app store certification yet. IMHO it is a bit of a hole in the logging functionality, as this is often when you most need access to the logging. I raised the idea Expose logging from a Beta managed package in the deployed org to see if the situation could be improved.

Outside of that the next best option is to create your own logging custom object and write important logging events there. I'd probably combine this with a custom setting so it is only written to when required.

Here is link how to check Debug logs for your app package - https://help.salesforce.com/apex/HTViewHelpDoc?id=apex_debugging_sub_org.htm&language=en_US

  • 1
    This is a good question regarding implementing logging if you want to go this route, salesforce.stackexchange.com/questions/10624/… – Andrew Fawcett Jun 1 '13 at 10:57
  • Thanks a lot for your help @Andrew. This is exactly what I was looking for. – PK85 Jun 1 '13 at 19:48
  • FYI, if you're looking for beta managed package logging solution then see my answer below. – Brent Matzelle Oct 24 '14 at 17:56
  • If I call a method in a beta managed package that throws an exception, I'm seeing stack traces containing apex classes with line numbers from within the package as of Spring 16. I don't see anything in the release notes about this so I'm not sure if it's a feature or bug. – xn. Feb 21 '16 at 19:25
9

As Daniel said in his excellent accepted answer the subscribers tab is the way to go here. But there are a few holes in it. As mentioned, what to do about not-yet-reviewed apps, betas, or even just for customers that can't give you admin level logins (needed to set debug log monitored users) for compliance reasons.

And there is an answer here, although it's not publicly documented that I know of: open a salesforce case, identify yourself as the package author, and give the namespace and a timespan of how long the customer should be able to see your logs.

The "backline"/tier3 support folks have a tool that can expose logs for a specific namespace this way. I've used it many times for customers that had compliance issues to at least let them get logs to send us.

  • 1
    If one customer installs app in sandbox and then in production as well. Do both org show up in my LMA app, so that I can check logs? (provided that app is reviewed and is on appxchange) – PK85 Jun 4 '13 at 3:16
  • @PK85 They will both show under the subscribers tab but not have unique entries in the licenses tab. – ca_peterson Jun 4 '13 at 4:41
2

There is a solution that allows you to add logging for both a deployed managed package AND a beta managed package by using a third party service platform such as Loggly, Splunk or LogRythm to provide remote logging. Loggly for example has an HTTP/S service that you can use to send logs. There is even an open source Apex library called sloggly that lets you get started very quickly. Here's a code snippet from the web site:

Loggly.singleLog('Error Message', DateTime.now(), 'LEVEL');

As a bonus these logging platforms give you a lot of really handy features that the Salesforce System.debug() method does not such as highly configurable alerts and reporting.

NOTE: It's important to choose a vendor that supports HTTPS requests because that's all that Salesforce supports. HTTP or TCP will not work, which is why I didn't add LogEntries to the list (because they deprecated their HTTP API).

0

I have found the Salesforce Event Log File Browser (https://salesforce-elf.herokuapp.com/) to be very helpful in troubleshooting . There are several different log file types from which to choose. And I didn't have to modify my custom code to enable this feature.

ApexCallout shows calls from Salesforce to my third party service with URL, status, response size and more.

QueuedExecution shows how long my custom actions take on the Salesforce platform.

RestAPI shows calls from my application to Salesforce.

https://trailhead.salesforce.com/en/modules/event_monitoring/units/event_monitoring_download has more details.

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.