How to Debug Managed Packages in Production org

Approx 20 min read

Table of Contents

Why OpenAI is Transforming Equipment Repair
Why OpenAI is Transforming Equipment Repair
Why OpenAI is Transforming Equipment Repair
Why OpenAI is Transforming Equipment Repair
Why OpenAI is Transforming Equipment Repair
Why OpenAI is Transforming Equipment Repair

Debugging production issues in an ISV (Independent Software Vendor) org can be complex and high stakes. As an ISV, you manage not only your applications but also their interactions with Salesforce environments and other integrations. Production environments, with their live data and active users, demand careful handling to avoid disruptions and ensure smooth operations.

In this blog, we’ll explain a step-by-step approach to debugging production issues in your Salesforce ISV org. Whether you’re dealing with Salesforce Managed Packages, complex integrations, or performance hiccups, these practical techniques will help you tackle issues with confidence and minimize disruption for your users. Dive in to learn how to methodically address Salesforce problems and keep your Salesforce production environment running smoothly.

Limitations of Debugging a Managed Package from Production Org

When debugging production issues of a managed package in a Salesforce production org, one important thing to note is that packaged code from Salesforce Managed Packages won’t be fully visible in the Salesforce debug logs generated within a production org. This is a security measure that protects the intellectual property of the ISV. As a result, the debug logs will show placeholders for the packaged code, making it difficult to directly trace issues related to these components.

Steps to Debug Managed Package Production Issues

Step 1: Request Login Access from Subscribers

Ask the subscriber to enable Grant Account Login Access. To do this, go to the settings from the View Profile icon. Select Grant Account Login Access from My Personal Information. Select the access duration for the ISV package’s support and not Salesforce.com Support (as that is for Salesforce only).

Grant login access

Step 2: Log In to a Subscriber Org

Before you’ve logged in to the LMA using multi-factor authentication, make sure that you’ve been granted login access by your subscriber.

  • Find the Subscriber Org: In the License Management App (LMA), head to the “Subscribers” tab.
  • Search for the Subscriber: Type the subscriber’s name or org ID into the search box and click “Search”.
  • Select the Org: From the search results, click on the name of the subscriber org you want to access.
  • Log In: On the Org Details page, click the “Login” button next to the user’s name. This will log you in with the same permission as that user.

Step 3: Debug Subscriber Orgs

After logging into a subscriber’s org, you can view logs, check the code in your package, and start ISV Customer Debugger sessions.

If you have access, set up a debug log by going to Setup, typing “Debug Logs” in the Quick Find box, and selecting Debug Logs. After setting up the debug log, generate Apex debug logs that include details from your Salesforce Managed Package. This information helps you find and fix issues specific to that subscriber.

Recommendation for Custom Logging in Managed Packages

To enhance the debugging process for Salesforce Managed Packages, it’s highly recommended to implement custom logging within your managed package for all integrations and exceptions. Custom logs can capture detailed information about interactions between your package and external systems, as well as any exceptions handled by the package. By creating dedicated log entries for each integration point, you can track data flow and identify issues more effectively.

Additionally, logging exceptions with detailed context—such as the error message, stack trace, and affected components—will provide valuable insights into any problems encountered during execution. This proactive approach to logging will not only aid in troubleshooting but also help you avoid having to reproduce issues in production. By having comprehensive logs available, you can diagnose and address problems without the need for repeated attempts to replicate them in a live environment, ultimately improving the overall reliability and supportability of your Salesforce Managed Package.

Reference URLs

To initiate debugging sessions only from a customer’s sandbox, refer to the ISV Customer Debugger.

Ready to Transform with AI?

More Insights for you